From f8161c8c72f4ec9bf6ad933ae84838c410630d14 Mon Sep 17 00:00:00 2001 From: Daniel Hougaard Date: Thu, 19 Sep 2024 20:06:19 +0400 Subject: [PATCH] Update error-handler.ts --- backend/src/server/plugins/error-handler.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/backend/src/server/plugins/error-handler.ts b/backend/src/server/plugins/error-handler.ts index 871b071e7..1aa2c0a44 100644 --- a/backend/src/server/plugins/error-handler.ts +++ b/backend/src/server/plugins/error-handler.ts @@ -1,6 +1,6 @@ import { ForbiddenError } from "@casl/ability"; import fastifyPlugin from "fastify-plugin"; -import { JsonWebTokenError } from "jsonwebtoken"; +import jwt from "jsonwebtoken"; import { ZodError } from "zod"; import { @@ -44,7 +44,7 @@ export const fastifyErrHandler = fastifyPlugin(async (server: FastifyZodProvider detail: error.detail }); // Handle JWT errors and make them more human-readable for the end-user. - } else if (error instanceof JsonWebTokenError) { + } else if (error instanceof jwt.JsonWebTokenError) { const message = (() => { if (error.message === JWTErrors.JwtExpired) { return "Your token has expired. Please re-authenticate.";