From 7849ebf3f9cf99d0897a70945e138d597b3cb1e8 Mon Sep 17 00:00:00 2001 From: dominik-zeglen Date: Tue, 18 Aug 2020 17:20:06 +0200 Subject: [PATCH] Fix Value PermissionDenied not found in enum --- src/auth/errors.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/auth/errors.ts b/src/auth/errors.ts index 4ced5f7a0..092f745d2 100644 --- a/src/auth/errors.ts +++ b/src/auth/errors.ts @@ -8,7 +8,14 @@ export enum JWTError { } export function isJwtError(error: GraphQLError): boolean { - return !!findValueInEnum(error.extensions.exception.code, JWTError); + let jwtError: boolean; + try { + jwtError = !!findValueInEnum(error.extensions.exception.code, JWTError); + } catch (e) { + jwtError = false; + } + + return jwtError; } export function isTokenExpired(error: GraphQLError): boolean {