Skip to content

Commit ba0a51d

Browse files
authored
Fixes unhandled promise rejection error while sending push (#4172)
1 parent 8d8a8b2 commit ba0a51d

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

src/Routers/PushRouter.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,9 @@ export class PushRouter extends PromiseRouter {
1919
const promise = new Promise((_resolve) => {
2020
resolve = _resolve;
2121
});
22-
pushController.sendPush(req.body, where, req.config, req.auth, (pushStatusId) => {
22+
let pushStatusId;
23+
pushController.sendPush(req.body, where, req.config, req.auth, (objectId) => {
24+
pushStatusId = objectId;
2325
resolve({
2426
headers: {
2527
'X-Parse-Push-Status-Id': pushStatusId
@@ -28,7 +30,9 @@ export class PushRouter extends PromiseRouter {
2830
result: true
2931
}
3032
});
31-
}).catch(req.config.loggerController.error);
33+
}).catch((err) => {
34+
req.config.loggerController.error(`_PushStatus ${pushStatusId}: error while sending push`, err);
35+
});
3236
return promise;
3337
}
3438

src/StatusHandler.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,6 @@ export function pushStatusHandler(config, objectId = newObjectId(config.objectId
247247
status: 'failed',
248248
updatedAt: new Date()
249249
}
250-
logger.warn(`_PushStatus ${objectId}: error while sending push`, err);
251250
return handler.update({ objectId }, update);
252251
}
253252

0 commit comments

Comments
 (0)