Skip to content

Commit 95a0d36

Browse files
chemidyhiranya911
authored andcommitted
fix FcmErrorCode error type (#391)
* fix FcmErrorCode error type * add changelog
1 parent cc1fb94 commit 95a0d36

File tree

3 files changed

+4
-3
lines changed

3 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Unreleased
22

3-
-
3+
- [fixed] Fixing error handling in FCM. The SDK now checks the key
4+
type.googleapis.com/google.firebase.fcm.v1.FcmError to set error code.
45

56
# v6.1.0
67

src/messaging/messaging-api-request.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export class FirebaseMessagingRequestHandler {
4545
return response.error;
4646
}
4747
if (validator.isArray(response.error.details)) {
48-
const fcmErrorType = 'type.googleapis.com/google.firebase.fcm.v1.FcmErrorCode';
48+
const fcmErrorType = 'type.googleapis.com/google.firebase.fcm.v1.FcmError';
4949
for (const element of response.error.details) {
5050
if (element['@type'] === fcmErrorType) {
5151
return element.errorCode;

test/unit/messaging/messaging.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -413,7 +413,7 @@ describe('Messaging', () => {
413413
message: 'test error message',
414414
details: [
415415
{
416-
'@type': 'type.googleapis.com/google.firebase.fcm.v1.FcmErrorCode',
416+
'@type': 'type.googleapis.com/google.firebase.fcm.v1.FcmError',
417417
'errorCode': 'UNREGISTERED',
418418
},
419419
],

0 commit comments

Comments
 (0)