Uploaded image for project: 'ui-eholdings'
  1. ui-eholdings
  2. UIEH-464

Spike: Error message handling in mod-kb-ebsco: Define approach

    XMLWordPrintable

    Details

    • Type: Story
    • Status: Closed (View Workflow)
    • Priority: P3
    • Resolution: Done
    • Affects Version/s: None
    • Fix Version/s: 1.0.0
    • Labels:
    • Template:
    • Sprint:
      eHoldings Sprint 45
    • Story Points:
      5

      Description

      While writing API tests, Carole and I ran into a bunch of examples where the error message returned from mod-kb-ebsco does not make complete sense since its doing a straight pass-through to and from RM API.

      Deliverables

      • Determine approach for handling error messaging

      Few examples:

      GET /eholdings/titles?q=
      

      Error response:

      {
       "errors": [
             {
                   "title": "Parameter OrderBy should be by TitleName when parameter Search is empty."
              }
           ],
          "jsonapi": {
             "version": "1.0"
          }
      }
      
      GET /eholdings/titles
      

      Error response:

      {
          "errors": [
              {
                  "title": "Parameter Search is missing."
              },
              {
                  "title": "Parameter SearchField is missing."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      GET /eholdings/providers?q=
      

      Error Response:

      {
          "errors": [
              {
                  "title": "Parameter OrderBy should be by ProviderName when parameter Search is empty."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      GET  {{protocol}}://{{url}}:{{okapiport}}/eholdings/providers/19/packages?q=
      

      Error response:

      {
          "errors": [
              {
                  "title": "Parameter OrderBy should be by PackageName when parameter Search is empty."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      GET 
      /eholdings/providers/19/packages?q=Search&count=5&page=abc
      

      Error response:

      {
          "errors": [
              {
                  "title": "The value provided for 'offset' is invalid"
              },
              {
                  "title": "Parameter Offset is missing."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      GET /eholdings/packages?q=
      

      Error response:

      {
          "errors": [
              {
                  "title": "Parameter OrderBy should be by PackageName when parameter Search is empty"
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      GET /eholdings/packages?q=ABC-CLIO&page=abc
      

      Error response:

      {
          "errors": [
              {
                  "title": "The value provided for 'offset' is invalid"
              },
              {
                  "title": "Parameter Offset is missing."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      GET /eholdings/packages/1
      

      Error response:

      {
          "errors": [
              {
                  "title": "Invalid value for orderby. Acceptable values are: Relevance, 0, PackageName, 1"
              },
              {
                  "title": "Parameter Count is missing."
              },
              {
                  "title": "Parameter Offset is missing."
              },
              {
                  "title": "Parameter OrderBy is missing."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }

      JSON API schema validation fails because of this:
      GET /eholdings/packages/abc gives a 400 with the following error message which is missing "errors" array and schema validation fails.
      GET /eholdings/packages/abc-abc gives a 404 with the same error message as below which is missing "errors" array and schema validation fails.

      {
          "jsonapi": {
              "version": "1.0"
          }
      }
      
      POST /eholdings/resources
      

      Body contains an invalid packageId

      {
        "data": {
          "type": "resources",
          "attributes": {
            "packageId": "1",
            "titleId": "",
            "url": "http://test"
          }
        }
      }
      

      Error response:

      {
          "errors": [
              {
                  "title": "Invalid value for orderby. Acceptable values are: Relevance, 0, PackageName, 1"
              },
              {
                  "title": "Parameter Count is missing."
              },
              {
                  "title": "Parameter Offset is missing."
              },
              {
                  "title": "Parameter OrderBy is missing."
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      GET eholdings/resources/1
      

      Error response:

      {
          "errors": [
              {
                  "title": "Invalid package_id",
                  "detail": "Package can't be blank",
                  "source": {}
              },
              {
                  "title": "Invalid package_id",
                  "detail": "Package :Invalid package id",
                  "source": {}
              },
              {
                  "title": "Invalid title_id",
                  "detail": "Title can't be blank",
                  "source": {}
              },
              {
                  "title": "Invalid title_id",
                  "detail": "Title :Invalid title id",
                  "source": {}
              }
          ],
          "jsonapi": {
              "version": "1.0"
          }
      }
      

      PUT /eholdings/packages/583-4345 with the following values set to "invalid" --> "isSelected", "visibilityData" -> "isHidden" or "allowKbToAddTitles" gives a 400 with the same error message as below which is missing "errors" array and schema validation fails.

      {
      "jsonapi":

      { "version": "1.0" }

      }

        TestRail: Results

          Attachments

            Issue Links

              Activity

                People

                Assignee:
                cowboyd Charles Lowell
                Reporter:
                sduvvuri Sobha Duvvuri
                Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                  Dates

                  Created:
                  Updated:
                  Resolved:

                    TestRail: Runs

                      TestRail: Cases