From 98a7249cb3d23c537d00e2f29412b1c999c9b588 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Wed, 22 Jan 2025 17:13:19 -0800 Subject: [PATCH 1/2] return the caught error in the error message Signed-off-by: Ryan Tate --- src/JWT.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/JWT.ts b/src/JWT.ts index 7c4e8879..4cf6fc99 100644 --- a/src/JWT.ts +++ b/src/JWT.ts @@ -198,8 +198,8 @@ export function decodeJWT(jwt: string, recurse = true): JWTDecoded { return innerDecodedJwt } return decodedJwt - } catch (e) { - throw new Error('invalid_argument: Incorrect format JWT') + } catch (e: any) { + throw new Error(`invalid_argument: ${JWT_ERROR.INVALID_JWT}: ${e}`) } } From 57fcd0567ada545670f95912f3c206c0d9f87340 Mon Sep 17 00:00:00 2001 From: Ryan Tate Date: Thu, 23 Jan 2025 08:36:38 -0800 Subject: [PATCH 2/2] fix linter, remove any type definition Signed-off-by: Ryan Tate --- src/JWT.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/JWT.ts b/src/JWT.ts index 4cf6fc99..d9bdde81 100644 --- a/src/JWT.ts +++ b/src/JWT.ts @@ -198,7 +198,7 @@ export function decodeJWT(jwt: string, recurse = true): JWTDecoded { return innerDecodedJwt } return decodedJwt - } catch (e: any) { + } catch (e) { throw new Error(`invalid_argument: ${JWT_ERROR.INVALID_JWT}: ${e}`) } }