From 3cf02b6e9c968e8cb598a92d058b11a93b97e616 Mon Sep 17 00:00:00 2001 From: Alec Jacobs Date: Fri, 27 May 2022 10:22:01 -0700 Subject: [PATCH] feat(plugins/pagerduty): handle 404 error code in Api Client * raise NotFoundError Signed-off-by: Alec Jacobs --- plugins/pagerduty/src/api/client.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugins/pagerduty/src/api/client.ts b/plugins/pagerduty/src/api/client.ts index ddf4248934..6c31f2a5d0 100644 --- a/plugins/pagerduty/src/api/client.ts +++ b/plugins/pagerduty/src/api/client.ts @@ -164,6 +164,11 @@ export class PagerDutyClient implements PagerDutyApi { if (response.status === 401) { throw new UnauthorizedError(); } + + if (response.status === 404) { + throw new NotFoundError(); + } + if (!response.ok) { const payload = await response.json(); const errors = payload.errors.map((error: string) => error).join(' ');