Error messages

Commerce uses a standard format for REST errors.

REST calls that produce errors return the following response fields:

  • message – the error message
  • status – the HTTP status code
  • errorCode – the system error code that uniquely identifies the error

For example:

{
    "message": "Required header is missing: x-ccasset-language",
    "status": "400",
    "errorCode": "82001"
}

Some errors use the multiple-error format instead, which encapsulates one or more errors in an errors array object. Each entry in the array is a separate error, with its own message, status, and errorCode values. In addition, the format includes top-level message and status values that apply globally to all of the errors. For example:

{
    "message": "Error while retrieving the products",
    "errors": [
        {
            "message": "Product Id xprod100 is invalid or non-existent.",
            "status": "400",
            "errorCode": "20031",
        },
        {
            "message": "Product Id xprod102 is invalid or non-existent.",
            "status": "400",
            "errorCode": "20031",
        }
    ],
    "status": "400"
}