mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 11:27:32 +00:00
Merge pull request #2456 from Infisical/daniel/unblock-gamma
Update error-handler.ts
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
import { ForbiddenError } from "@casl/ability";
|
import { ForbiddenError } from "@casl/ability";
|
||||||
import fastifyPlugin from "fastify-plugin";
|
import fastifyPlugin from "fastify-plugin";
|
||||||
import { JsonWebTokenError } from "jsonwebtoken";
|
import jwt from "jsonwebtoken";
|
||||||
import { ZodError } from "zod";
|
import { ZodError } from "zod";
|
||||||
|
|
||||||
import {
|
import {
|
||||||
@@ -44,7 +44,7 @@ export const fastifyErrHandler = fastifyPlugin(async (server: FastifyZodProvider
|
|||||||
detail: error.detail
|
detail: error.detail
|
||||||
});
|
});
|
||||||
// Handle JWT errors and make them more human-readable for the end-user.
|
// 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 = (() => {
|
const message = (() => {
|
||||||
if (error.message === JWTErrors.JwtExpired) {
|
if (error.message === JWTErrors.JwtExpired) {
|
||||||
return "Your token has expired. Please re-authenticate.";
|
return "Your token has expired. Please re-authenticate.";
|
||||||
|
|||||||
Reference in New Issue
Block a user