Error handling for REST APIs

This information covers HTTP Exceptions, SPE Exceptions encountered during processing, and other errors.

HTTP exceptions

HTTP exceptions are handled by your Liberty server and the product. An example authentication exception appears as follows:
{
  "errorCode": 401,
  "errorDescription": "Unauthorized"
}
An example "URL not found" exception appears as follows:
{
  "errorCode": 404,
  "errorDescription": "Not found"
}

SPE exceptions

SPE Exceptions encountered during processing are returned in the SPEResponse document, including the Status, Advanced Status and any associated report.

The following example is a DeenvelopeJob failure in JSON format:
"SPEResponse": {
      "Response": {
        "Status": 1,
        "AdvancedStatus": "Resource X12-0: ISA Envelope Lookup Failed",
        "Report": "Resource cc59bc85-dc43-4fe8-8d91-8220344d54dd: Extracting EDIFACT interchanges...
In this example, the following information is reported:
Status
“1” denotes failure.
Advanced Status
The specific cause of the failure.
Report
Detailed information, if available.
Severity
Provided from the Response object returned by SPE.
Reason
Provided from the Response object returned by SPE.
This is an example in JSON format of a DeenvelopeJob failure for a missing translation map:
"SPEResponse": {
      "Response": {
        "Status": 1,
        "AdvancedStatus": "",
        "Severity": "8",
        "Reason": "-1",
        "Report": "Resource 10fe208c-f099-4090-a48f-b0c77b88e1bf: Map Name: EDIRepeatingElements ...

Other errors

Other errors are written to Liberty logs. The default location is spe_install_dir/tpuiserver/usr/servers/defaultServer/logs.