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 {