mirror of
https://github.com/brendan-ch/project-inter-server.git
synced 2026-04-17 16:00:32 +00:00
propagate error message down to outer catch statement
This commit is contained in:
@@ -126,8 +126,7 @@ export class NotificationService {
|
||||
await new Promise<void>((resolve, reject) => {
|
||||
req.on('response', (headers, flags) => {
|
||||
if (headers[":status"] !== 200) {
|
||||
console.error(`APNs request failed with status ${headers[":status"]}`);
|
||||
reject();
|
||||
reject(`APNs request failed with status ${headers[":status"]}`);
|
||||
}
|
||||
resolve();
|
||||
});
|
||||
@@ -142,25 +141,6 @@ export class NotificationService {
|
||||
}));
|
||||
req.end();
|
||||
});
|
||||
|
||||
// const response = await fetch(url, {
|
||||
// method: "POST",
|
||||
// headers,
|
||||
// body: JSON.stringify({
|
||||
// aps: {
|
||||
// alert: {
|
||||
// title: "Shuttle is arriving",
|
||||
// body: `Shuttle is approaching ${stop.name} in ${Math.ceil(eta.secondsRemaining / 60)} minutes.`
|
||||
// }
|
||||
// }
|
||||
// }),
|
||||
// });
|
||||
// const json = await response.json();
|
||||
|
||||
// if (response.status !== 200) {
|
||||
// console.error(`Notification failed for device ${deviceId}:`, json.reason);
|
||||
// return false;
|
||||
// }
|
||||
return true;
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
|
||||
Reference in New Issue
Block a user