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