internal static int ErrorToCode()

in database/src/DatabaseError.cs [194:220]


    internal static int ErrorToCode(Error error) {
      switch (error) {
        case Error.Disconnected: return Disconnected;
        case Error.ExpiredToken: return ExpiredToken;
        case Error.InvalidToken: return InvalidToken;
        case Error.MaxRetries: return MaxRetries;
        case Error.NetworkError: return NetworkError;
        case Error.OperationFailed: return OperationFailed;
        case Error.OverriddenBySet: return OverriddenBySet;
        case Error.PermissionDenied: return PermissionDenied;
        case Error.Unavailable: return Unavailable;
        case Error.UnknownError: return UnknownError;
        case Error.WriteCanceled: return WriteCanceled;
        // You specified an invalid Variant type for a field. For example,
        // a DatabaseReference's Priority and the keys of a Map must be of
        // scalar type (MutableString, StaticString, Int64, Double).
        case Error.InvalidVariantType: // TODO
        // An operation that conflicts with this one is already in progress. For
        // example, calling SetValue and SetValueAndPriority on a DatabaseReference
        // is not allowed.
        case Error.ConflictingOperationInProgress: // TODO
        // The transaction was aborted, because the user's DoTransaction function
        // returned kTransactionResultAbort instead of kTransactionResultSuccess.
        case Error.TransactionAbortedByUser: // TODO
        default: return UnknownError;
      }
    }