From f7ba974d9763b104a3e4c86545db0c3b7c6d6b90 Mon Sep 17 00:00:00 2001 From: Alejandro Celaya Date: Tue, 15 Nov 2022 12:15:04 +0100 Subject: [PATCH] Fixed logic to determine if an error is a ProblemDetailError --- src/api/utils/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/utils/index.ts b/src/api/utils/index.ts index 162040c8..4d60a21e 100644 --- a/src/api/utils/index.ts +++ b/src/api/utils/index.ts @@ -8,7 +8,7 @@ import { } from '../types/errors'; const isProblemDetails = (e: unknown): e is ProblemDetailsError => - !!e && typeof e === 'object' && Object.keys(e).every((key) => ['type', 'detail', 'title', 'status'].includes(key)); + !!e && typeof e === 'object' && ['type', 'detail', 'title', 'status'].every((prop) => prop in e); export const parseApiError = (e: unknown): ProblemDetailsError | undefined => (isProblemDetails(e) ? e : undefined);