Error handling

Error handling is done through HTTP error codes and appropriate error objects.

Error Objects

A failed API call will place an object in the entity similar to this:

{
  "error"
  {"type" : The java type of the exception that was thrown to generate this error,
   "parentError" : The nested error object that was the cause of thisexception  
                          (This field is included only when this error has a nested error),
   "message" : The message from this error code,
   "stackTrace" : This array contains lines of a stacktrace, each will correspond 
        	                     to a stackframe or an exception label if there are nested exceptions
   [...]
   }
}

Common error behavior

All REST urls defined have a common error behavior. An error response returned by the server consists of two parts:

  1. A HTTP status code other than 200.
  2. A JSON Object in the response payload containing the error property.

Common HTTP status codes

The server can return following codes:

  • 200 OK The request was processed successfully.
  • 400 Bad request An incorrect request.
  • 500 Internal Server Error The server encountered an error while processing the request.