Skip to content
Snippets Groups Projects
Commit 2be5ea5a authored by Razzan Yoni's avatar Razzan Yoni
Browse files

refactor : resolve throw error

parent a9b2e645
Branches
Tags
1 merge request!2Dev
...@@ -58,12 +58,12 @@ const verifyToken = async (req: Request, res: Response, next: NextFunction) => { ...@@ -58,12 +58,12 @@ const verifyToken = async (req: Request, res: Response, next: NextFunction) => {
next(); // The token is verified, pass to the next middleware next(); // The token is verified, pass to the next middleware
} catch (error) { } catch (error) {
if (error instanceof TokenExpiredError) { if (error instanceof TokenExpiredError) {
throw new StandardError(ErrorType.ACCESS_TOKEN_EXPIRED); next(new StandardError(ErrorType.ACCESS_TOKEN_EXPIRED));
} else if (error instanceof NotBeforeError) { } else if (error instanceof NotBeforeError) {
throw new StandardError(ErrorType.ACCESS_TOKEN_NOT_ACTIVE); next(new StandardError(ErrorType.ACCESS_TOKEN_NOT_ACTIVE));
} }
// unknown error
throw error; next(error);
} }
}; };
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment