From 5e186c643cb26af89fb32abeb5cb3af867840dc9 Mon Sep 17 00:00:00 2001 From: Brendan Chen Date: Mon, 10 Feb 2025 13:32:26 -0800 Subject: [PATCH] propagate error message down to outer catch statement --- src/services/NotificationService.ts | 22 +--------------------- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/src/services/NotificationService.ts b/src/services/NotificationService.ts index a6b9162..d21726a 100644 --- a/src/services/NotificationService.ts +++ b/src/services/NotificationService.ts @@ -126,8 +126,7 @@ export class NotificationService { await new Promise((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);