Skip to content

Commit

Permalink
Cleanup error types
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Nov 21, 2024
1 parent 762f6f4 commit d164c4a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/apns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit d164c4a

Please sign in to comment.