Skip to content

Error Handling

When the server reports an error, it is delivered to the client through an instance of the BackendlessFault class. A BackendlessFault object provides access to an error code which uniquely identifies the root cause of the error. In addition to the error code, the fault object may include an error message which provides additional information about the error:

package com.backendless.exceptions;

public class BackendlessFault
{
  // returns the error code
  public String getCode();

  // returns the error message which provides additional information about the error
  public String getMessage();

  public String getDetail();
  public String toString();
}

The asynchronous API calls accept the AsyncCallback argument which receives the fault object through the following method:

public void handleFault( BackendlessFault fault )

If a server error occurs during a synchronous/blocking API invocation, it is thrown to the client as a checked exception - BackendlessException:

package com.backendless.exceptions;

public class BackendlessException extends Throwable
{
  // http status code returned by the server or custom code
  public int getHttpStatusCode();

  // Backendless error code
  public String getCode()

  // Error message corresponding to the error code
  public String getMessage()

  // Detailed information (possibly a stack trace) corresponding to the exception
  public String getDetail()
}

Error Codes

Click here for the complete list of Backendless Error Codes