Skip to content

Commit 5b970aa

Browse files
committed
rename option to resolveUnhandledClientError
1 parent e07e45d commit 5b970aa

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,8 +163,8 @@ android: {
163163

164164
Occasionally, errors within the Firebase Cloud Messaging (FCM) client may not be managed internally and are instead passed to the Parse Server Push Adapter. These errors can occur, for instance, due to unhandled FCM server connection issues.
165165

166-
- `fcmResolveUnhandledClientError: true`: Logs the error and gracefully resolves it, ensuring that push sending does not result in a failure.
167-
- `fcmResolveUnhandledClientError: false`: Causes push sending to fail, returning a `Parse.Error.OTHER_CAUSE` with error details that can be parsed to handle it accordingly. This is the default.
166+
- `resolveUnhandledClientError: true`: Logs the error and gracefully resolves it, ensuring that push sending does not result in a failure.
167+
- `resolveUnhandledClientError: false`: Causes push sending to fail, returning a `Parse.Error.OTHER_CAUSE` with error details that can be parsed to handle it accordingly. This is the default.
168168

169169
In both cases, detailed error logs are recorded in the Parse Server logs for debugging purposes.
170170

spec/FCM.spec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import path from 'path';
1+
import { deleteApp, getApps } from 'firebase-admin/app';
22
import log from 'npmlog';
3-
import FCM from '../src/FCM.js';
4-
import { getApps, deleteApp } from 'firebase-admin/app';
53
import Parse from 'parse/node.js';
4+
import path from 'path';
5+
import FCM from '../src/FCM.js';
66

77
let testArgs;
88

@@ -227,7 +227,7 @@ describe('FCM', () => {
227227
it('rejects exceptions that are unhandled by FCM client', async () => {
228228
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
229229
const spyError = spyOn(log, 'error').and.callFake(() => {});
230-
testArgs.fcmResolveUnhandledClientError = false;
230+
testArgs.resolveUnhandledClientError = false;
231231
const fcm = new FCM(testArgs);
232232
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
233233
throw new Error('test error');
@@ -246,7 +246,7 @@ describe('FCM', () => {
246246
it('resolves exceptions that are unhandled by FCM client', async () => {
247247
const spyInfo = spyOn(log, 'info').and.callFake(() => {});
248248
const spyError = spyOn(log, 'error').and.callFake(() => {});
249-
testArgs.fcmResolveUnhandledClientError = true;
249+
testArgs.resolveUnhandledClientError = true;
250250
const fcm = new FCM(testArgs);
251251
spyOn(fcm.sender, 'sendEachForMulticast').and.callFake(() => {
252252
throw new Error('test error');

src/FCM.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
'use strict';
22

3-
import Parse from 'parse';
4-
import log from 'npmlog';
5-
import { initializeApp, cert, getApps, getApp } from 'firebase-admin/app';
3+
import { cert, getApp, getApps, initializeApp } from 'firebase-admin/app';
64
import { getMessaging } from 'firebase-admin/messaging';
5+
import log from 'npmlog';
6+
import Parse from 'parse';
77
import { randomString } from './PushAdapterUtils.js';
88

99
const LOG_PREFIX = 'parse-server-push-adapter FCM';
@@ -28,8 +28,8 @@ export default function FCM(args, pushType) {
2828
const fcmEnableLegacyHttpTransport = typeof args.fcmEnableLegacyHttpTransport === 'boolean'
2929
? args.fcmEnableLegacyHttpTransport
3030
: false;
31-
this.fcmResolveUnhandledClientError = typeof args.fcmResolveUnhandledClientError === 'boolean'
32-
? args.fcmResolveUnhandledClientError
31+
this.resolveUnhandledClientError = typeof args.resolveUnhandledClientError === 'boolean'
32+
? args.resolveUnhandledClientError
3333
: false;
3434

3535
let app;
@@ -155,7 +155,7 @@ FCM.prototype.send = function (data, devices) {
155155
slices.map((slice) => sendToDeviceSlice(slice, this.pushType)),
156156
).catch(e => {
157157
log.error(LOG_PREFIX, `error sending push: ${e}`);
158-
if (!this.fcmResolveUnhandledClientError && e instanceof Parse.Error && e.code === Parse.Error.OTHER_CAUSE) {
158+
if (!this.resolveUnhandledClientError && e instanceof Parse.Error && e.code === Parse.Error.OTHER_CAUSE) {
159159
return Promise.reject(e);
160160
}
161161
});

0 commit comments

Comments
 (0)