Summary: Constants | Methods | Inherited Methods | [Expand All]
public class

# DatabaseError

extends Object

java.lang.Object
↳ | com.google.firebase.database.DatabaseError

## Class Overview

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

## Summary

Constants
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 Methods
static DatabaseError | fromException(Throwable e)
int | getCode()
String | getDetails()
String | getMessage()
DatabaseException | toException() Can be used if a third party needs an Exception from Firebase Database for integration purposes.
String | toString()

[Expand] Inherited Methods
From class java.lang.Object
Object | clone()
boolean | equals(Object arg0)
void | finalize()
final Class<?> | getClass()
int | hashCode()
final void | notify()
final void | notifyAll()
String | toString()
final void | wait(long arg0, int arg1)
final void | wait(long arg0)
final void | wait()

## Constants

#### public static final int DATA_STALE

Internal use

Constant Value: -1 (0xffffffff)

#### public static final int DISCONNECTED

The operation had to be aborted due to a network disconnect

Constant Value: -4 (0xfffffffc)

#### public static final int EXPIRED_TOKEN

The supplied auth token has expired

Constant Value: -6 (0xfffffffa)

#### 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 (0xfffffff9)

#### public static final int MAX_RETRIES

The transaction had too many retries

Constant Value: -8 (0xfffffff8)

#### public static final int NETWORK_ERROR

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

Constant Value: -24 (0xffffffe8)

#### public static final int OPERATION_FAILED

The server indicated that this operation failed

Constant Value: -2 (0xfffffffe)

#### public static final int OVERRIDDEN_BY_SET

The transaction was overridden by a subsequent set

Constant Value: -9 (0xfffffff7)

#### public static final int PERMISSION_DENIED

This client does not have permission to perform this operation

Constant Value: -3 (0xfffffffd)

#### public static final int UNAVAILABLE

The service is unavailable

Constant Value: -10 (0xfffffff6)

#### 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 (0xfffffc19)

#### public static final int USER_CODE_EXCEPTION

An exception occurred in user code

Constant Value: -11 (0xfffffff5)

#### public static final int WRITE_CANCELED

The write was canceled locally

Constant Value: -25 (0xffffffe7)

## 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 ()