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