Handling errors

How to handle and understand errors in API responses.

When something goes wrong with a request, the response provides important informations to help to understand what happened and how to fix it.

Following there is an example of the error response structure:

{
  "responseData": "[Ingresse Exception Error] DATABASE EXCEPTION - ERROR 3002 - Event ID not found.\nFields: eventId=> 9999999999999",
  "responseDetails": "OK",
  "responseError": {
    "status": false,
    "category": "DATABASE EXCEPTION",
    "code": 3002,
    "message": "Event ID not found.\nFields: eventId=> 999999999",
    "fields": {
      "eventId": "9999999999999"
    }
  },
  "responseStatus": 200
}

🚧

HTTP status code

The HTTP status code will be always 200.

responseData: a simple string containing a summary of all information in the responseError;

responseError.status: tells if whether or not the request could be processed;

category: may be one of the following values:

  • CONTEXT EXCEPTION
  • DATABASE EXCEPTION
  • EXTERNAL ERROR EXCEPTION
  • FATAL ERROR EXCEPTION
  • UNAUTHORIZED ACCESS EXCEPTION
  • USAGE EXCEPTION

code: an Ingresse's internal code that helps to identify a specific error.

message: a human readable message that describes the problem.

fields: an object with all data involved in the detection of the problem.