Skip to content

Error Handling

When the server reports an error, it is delivered to the client through a fault object, which is an untyped JavaScript object. The fault object has the same structure for both blocking and non-blocking invocations:

  "message": value,
  "statusCode": value


Argument                Description
message contains a string value with the description of the error
statusCode error code as a string value. Currently all the error codes are numbers, however the method returning the error code returns the String type. This is done for future expansion of the error code system which may include characters.

The asynchronous calls receive the fault through the catch() function of the returned promise object.

  .then( function() {
  .catch( function( error ) {
     console.log("error message - " + err.message);
     console.log("error code - " + err.statusCode);

For the synchronous calls the fault object is thrown as an error which must be handled in a catch( err ) block:

catch( err )
  console.log( "Error message - " + err.message );
  console.log( "Error code - " + err.statusCode );

Error Codes

Click here for the complete list of Backendless Error Codes