dvFcmFailureReason function
What FCM's v1 error codes mean, in words an operator can act on.
Implementation
String dvFcmFailureReason(String? errorCode, int status) =>
switch (errorCode) {
'UNREGISTERED' => 'The registration token is no longer valid: the app '
'was uninstalled or the token expired. Stop sending to it.',
'INVALID_ARGUMENT' => 'FCM rejected the request as malformed. Check the '
'token or topic, the payload size (4KB) and the data keys.',
'SENDER_ID_MISMATCH' => 'The token belongs to a different Firebase '
'project than the one this service account sends for.',
'QUOTA_EXCEEDED' => 'FCM quota exceeded for this project, device or '
'topic. Retry with backoff.',
'UNAVAILABLE' => 'FCM is temporarily unavailable. Retry with backoff.',
'INTERNAL' => 'FCM had an internal error. Retry with backoff.',
'THIRD_PARTY_AUTH_ERROR' => 'The iOS (APNs) credentials registered '
'with Firebase were rejected.',
_ => switch (status) {
401 => 'FCM rejected the access token. It may have expired or the '
'service account may lack the Firebase Cloud Messaging API role.',
403 => 'The service account may not send for this project.',
404 => 'The registration token is no longer valid.',
_ => 'The push service rejected the notification.',
},
};