FirebaseFirestoreAdminException.fromServerError constructor
FirebaseFirestoreAdminException.fromServerError(
{ - required String serverErrorCode,
- String? message,
- Object? rawServerResponse,
})
Implementation
@internal
factory FirebaseFirestoreAdminException.fromServerError({
required String serverErrorCode,
String? message,
Object? rawServerResponse,
}) {
// If not found, default to unknown error.
final error = firestoreServerToClientCode[serverErrorCode] ??
FirestoreClientErrorCode.unknown;
message ??= error.message;
if (error == FirestoreClientErrorCode.unknown &&
rawServerResponse != null) {
try {
message += ' Raw server response: "${jsonEncode(rawServerResponse)}"';
} catch (e) {
// Ignore JSON parsing error.
}
}
return FirebaseFirestoreAdminException(error, message);
}