DatabaseError

classDatabaseError


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

Summary

Constants

constInt

Internal use

constInt

The operation had to be aborted due to a network disconnect

constInt

The supplied auth token has expired

constInt

The specified authentication token is invalid.

constInt

The transaction had too many retries

constInt

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

constInt

The server indicated that this operation failed

constInt

The transaction was overridden by a subsequent set

constInt

This client does not have permission to perform this operation

constInt

The service is unavailable

constInt

An unknown error occurred.

constInt

An exception occurred in user code

constInt

The write was canceled locally

Public functions

java-staticDatabaseError
DatabaseException

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

String!

Constants

DATA_STALE

const val DATA_STALE = -1: Int

Internal use

DISCONNECTED

const val DISCONNECTED = -4: Int

The operation had to be aborted due to a network disconnect

EXPIRED_TOKEN

const val EXPIRED_TOKEN = -6: Int

The supplied auth token has expired

INVALID_TOKEN

const val INVALID_TOKEN = -7: Int

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.

MAX_RETRIES

const val MAX_RETRIES = -8: Int

The transaction had too many retries

NETWORK_ERROR

const val NETWORK_ERROR = -24: Int

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

OPERATION_FAILED

const val OPERATION_FAILED = -2: Int

The server indicated that this operation failed

OVERRIDDEN_BY_SET

const val OVERRIDDEN_BY_SET = -9: Int

The transaction was overridden by a subsequent set

PERMISSION_DENIED

const val PERMISSION_DENIED = -3: Int

This client does not have permission to perform this operation

UNAVAILABLE

const val UNAVAILABLE = -10: Int

The service is unavailable

UNKNOWN_ERROR

const val UNKNOWN_ERROR = -999: Int

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

USER_CODE_EXCEPTION

const val USER_CODE_EXCEPTION = -11: Int

An exception occurred in user code

WRITE_CANCELED

const val WRITE_CANCELED = -25: Int

The write was canceled locally

Public functions

fromException

java-static fun fromException(e: Throwable): DatabaseError

toException

fun toException(): DatabaseException

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

Returns
DatabaseException

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

toString

fun toString(): String!

Public properties

code

val codeInt

details

val detailsString!

message

val messageString!

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025-07-21 UTC.