The errors response object

You get an errors JSON object in the Sitecore Discover Search and Recommendation response if there was any error encountered during the processing of a request. The response contains an array of objects, where each object represents a single type of error. You can view the error messages and codes, error types, severity, and any additional information about the error in the response.

The following shows the basic structure of the errors object in a response:

{
    "errors": [{
	"message": "<message_string>",
	"type": "<error_type_string>",
	"code": 200,
	"severity": "<severity_string>",
	"details": {
	"<additional_information_key>": "<additional_information_value>"
	}
    }]
}

Keys

Depending on your request you might see some or all of the response keys.

The following table describes the keys in the errors object:

KeyTypeDescriptionValues
messagestringDescribes the error message.n/a
typestringIndicates the type of error encountered.n/a
codeintegerIndicates the numerical code of the error encountered.n/a
severitystringRepresents the severity level of an error.NoteSeverity is context-dependent and specific to your use case.lowmediumhigh
detailsobjectContains further information about the error. This object contains a map of keys or values.Example:"details": { "rfk_id": "rfkid_9" }n/a

Example

The following is an example of an error response where Discover did not recognize the page uri in the context of the request /random. If this is the only error, the response returns the errors object as an array with a single object.

"errors": [
   {
     "message": "page not found for uri",
     "type": "uri_not_found",
     "code": "1008",
     "severity": "high",
     "details": {
       "uri": "/random"
     }
   }
]
If you have suggestions for improving this article, let us know!