Error handling

Every endpoint in the API uses the problem+jsonstandard for error handling. All error responses will have a json response with application type application/problem+json containing a title and detail property, for example:

{
  "title": "NotFound",
  "status": 404,
  "detail": "Could not find store with id s_1234abcd",
  "errorCode": null
}

When additional information is available, more properties may be included in this response. For example, when creating a new sale, an issue can occur either before the sale is created or after it has been created and the transaction has started. If the problem occurs after the sale is created, the error response will include the sale as a property. This allows for more detailed analysis of what went wrong using the Transaction Error Codes.