From d164c4a2d4f320bb959502a5b869da1e44326a05 Mon Sep 17 00:00:00 2001 From: Andrew Barba Date: Thu, 21 Nov 2024 13:27:34 -0500 Subject: [PATCH] Cleanup error types --- src/apns.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/apns.ts b/src/apns.ts index 23b0671..62a94d7 100644 --- a/src/apns.ts +++ b/src/apns.ts @@ -113,19 +113,19 @@ export class ApnsClient extends EventEmitter { return notification } - const responseError = (await res.body.json().catch(() => ({ + const responseError = await res.body.json().catch(() => ({ reason: Errors.unknownError, timestamp: Date.now(), - }))) as ApnsResponseError + })) const error = new ApnsError({ statusCode: res.statusCode, notification: notification, - response: responseError, + response: responseError as ApnsResponseError, }) - // Emit specific and genericerror - this.emit(responseError.reason, error) + // Emit specific and generic errors + this.emit(error.reason, error) this.emit(Errors.error, error) throw error