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:

namespace BackendlessAPI.Exception
{
  public class BackendlessFault
  {
    // error code
    public string FaultCode;

    // error message
    public string Message;

    // error details;
    public string Detail; 
  }
}

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

public delegate void ErrorHandler( BackendlessFault fault );

For the APIs which use the async keyword, errors are thrown as exceptions. The top exception is System.AggregateException which wraps the underlying exception containing the information about the error.

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

namespace BackendlessAPI.Exception
{
  public class BackendlessException : System.Exception
  {
    public BackendlessFault BackendlessFault { get; }
    public string FaultCode { get; }
    public string Detail { get; }
    public override string Message { get; }
    public override string ToString();
  }
}

Error Codes

Click here for the complete list of Backendless Error Codes