diff --git a/backend/middlewares/auth.js b/backend/middlewares/auth.js index 618ca5286..d4a6d1525 100644 --- a/backend/middlewares/auth.js +++ b/backend/middlewares/auth.js @@ -6,9 +6,7 @@ module.exports = { try { const { authorization } = req.headers; if (!authorization) - return next( - new MonkeyError(404, "Unauthorized", "No authorization header") - ); + throw new MonkeyError(404, "Unauthorized", "No authorization header"); const token = authorization.split(" "); if (token[0].trim() !== "Bearer") return next(