DatabaseError

public class DatabaseError extends Object

Instances of DatabaseError are passed to callbacks when an operation failed. They contain a description of the specific error that occurred.

Constant Summary

int DATA_STALE Internal use.
int DISCONNECTED The operation had to be aborted due to a network disconnect.
int EXPIRED_TOKEN The supplied auth token has expired.
int INVALID_TOKEN The specified authentication token is invalid.
int MAX_RETRIES The transaction had too many retries
int NETWORK_ERROR The operation could not be performed due to a network error.
int OPERATION_FAILED The server indicated that this operation failed.
int OVERRIDDEN_BY_SET The transaction was overridden by a subsequent set
int PERMISSION_DENIED This client does not have permission to perform this operation.
int UNAVAILABLE The service is unavailable.
int UNKNOWN_ERROR An unknown error occurred.
int USER_CODE_EXCEPTION An exception occurred in user code.
int WRITE_CANCELED The write was canceled locally.

Public Method Summary

static DatabaseError
fromException(Throwable e)
int
String
String
DatabaseException
toException()
Can be used if a third party needs an Exception from Firebase Database for integration purposes.
String

Inherited Method Summary

Constants

public static final int DATA_STALE

Internal use.

Constant Value: -1

public static final int DISCONNECTED

The operation had to be aborted due to a network disconnect.

Constant Value: -4

public static final int EXPIRED_TOKEN

The supplied auth token has expired.

Constant Value: -6

public static final int INVALID_TOKEN

The specified authentication token is invalid. This can occur when the token is malformed, expired, or the secret that was used to generate it has been revoked.

Constant Value: -7

public static final int MAX_RETRIES

The transaction had too many retries

Constant Value: -8

public static final int NETWORK_ERROR

The operation could not be performed due to a network error.

Constant Value: -24

public static final int OPERATION_FAILED

The server indicated that this operation failed.

Constant Value: -2

public static final int OVERRIDDEN_BY_SET

The transaction was overridden by a subsequent set

Constant Value: -9

public static final int PERMISSION_DENIED

This client does not have permission to perform this operation.

Constant Value: -3

public static final int UNAVAILABLE

The service is unavailable.

Constant Value: -10

public static final int UNKNOWN_ERROR

An unknown error occurred. Please refer to the error message and error details for more information.

Constant Value: -999

public static final int USER_CODE_EXCEPTION

An exception occurred in user code.

Constant Value: -11

public static final int WRITE_CANCELED

The write was canceled locally.

Constant Value: -25

Public Methods

public static DatabaseError fromException (Throwable e)

public int getCode ()

Returns
  • One of the defined status codes, depending on the error.

public String getDetails ()

Returns
  • Human-readable details on the error and additional information, e.g. links to docs;

public String getMessage ()

Returns
  • A human-readable description of the error.

public DatabaseException toException ()

Can be used if a third party needs an Exception from Firebase Database for integration purposes.

Returns
  • An exception wrapping this error, with an appropriate message and no stack trace.

public String toString ()