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) => {
|
await new Promise<void>((resolve, reject) => {
|
||||||
req.on('response', (headers, flags) => {
|
req.on('response', (headers, flags) => {
|
||||||
if (headers[":status"] !== 200) {
|
if (headers[":status"] !== 200) {
|
||||||
console.error(`APNs request failed with status ${headers[":status"]}`);
|
reject(`APNs request failed with status ${headers[":status"]}`);
|
||||||
reject();
|
|
||||||
}
|
}
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
@@ -142,25 +141,6 @@ export class NotificationService {
|
|||||||
}));
|
}));
|
||||||
req.end();
|
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;
|
return true;
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user