Errors

Overview

The Search API may return the following types of errors:

  • Authentication errors
  • Invalid Accept-type errors
  • Server-side errors
  • Client-side errors
  • End-user errors

The error types, authentication and invalid Accept-type errors, do not return any error response body. Invalid Accept-type errors return an HTTP 406, and authentication errors return an HTTP 401. In the case of a 401 or 406 error, there will be an error message in the HTTP reason-phrase.

The following error types return error-response bodies:

  • Server-side errors return an HTTP 500 status, and indicate a server-side failure. This can happen if the server is currently experiencing technical difficulties, or in the case of a malfunction.
  • Client-side errors return an HTTP 400 status code, and indicate a coding error in the client. This will happen in the case of invalid syntax, incorrect encoding, incorrect escaping, or in general any error that causes the server to not be able to interpret the request.
  • End-user errors may occur on normal responses with HTTP 200 status. Since end users will likely have no way of seeing the HTTP status, and viewable results may be returned regardless of an end-user error, these errors are simply included in the response payload. These errors may include things like bad query syntax within a search, even if the search request is correctly formed, escaped, and encoded.

Example – Client side 400 error

Bad query issued by client:

s.cmd=addFacetField(foo)+fubar()

Response:

 <response>
    <errors>
      <error
       message="Error with command: addFacetField: Wrong number of arguments: 1"/>
      <error
       message="Error with command: fubar: Unknown command string: fubar"/>
    </errors>
</response>

For more specific information on the error field format, see Errors Response Field.

Example response

s.cmd=addFacetField(foo)+fubar()
{
  "version":"2.0.0",
  "sessionId":"test-application-74703",
  "errors":[
    {
      "message":"Error with parameter: s.cmd=addFacetField(foo) fubar(): Error with command: addFacetField: Wrong number of arguments: 1",
      "suppressedExceptions":[
        [
          
        ],
        [
          
        ]
      ],
      "code":"wrong.number.of.arguments"
    },
    {
      "message":"Error with parameter: s.cmd=addFacetField(foo) fubar(): Error with command: fubar: Unknown command string: fubar",
      "suppressedExceptions":[
        
      ],
      "code":"command.string.not.formed.correctly"
    }
  ]
}