throwing instead of calling next - maybe it will fix double errors

This commit is contained in:
Miodec 2021-08-17 21:35:44 +01:00
parent c6e8b69435
commit d2648fff07

View file

@ -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(