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:

RequestResponse
{
    "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:

Key

Type

Description

Values

message

string

Describes the error message.

n/a

type

string

Indicates the type of error encountered.

n/a

code

integer

Indicates the numerical code of the error encountered.

n/a

severity

string

Represents the severity level of an error.

Note

Severity is context-dependent and specific to your use case.

  • low

  • medium

  • high

details

object

Contains further information about the error. This object contains a map of keys or values.

Example:

RequestResponse
"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.

RequestResponse
"errors": [
   {
     "message": "page not found for uri",
     "type": "uri_not_found",
     "code": "1008",
     "severity": "high",
     "details": {
       "uri": "/random"
     }
   }
]

Do you have some feedback for us?

If you have suggestions for improving this article,