Error messages

Commerce uses a standard message format for REST errors.

This section applies to both OSF and Storefront Classic. This section applies to Open Storefront Framework (OSF) and Storefront Classic.

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"
}

For 400 level responses, message is a localized text that describes why the request triggered the error, and errorCode is an identifier that is the same regardless of locale. For 500 level responses, you can submit errorCode to your Oracle representative for troubleshooting.

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"
}