added another custom error handler

changed returned code
This commit is contained in:
Miodec 2023-01-29 15:14:46 +01:00
parent 2aa95b4526
commit 2dd1baac95

View file

@ -186,10 +186,16 @@ async function authenticateWithBearerToken(
);
} else if (errorCode?.includes("auth/user-not-found")) {
throw new MonkeyError(
401,
404,
"User not found.",
"authenticateWithBearerToken"
);
} else if (errorCode?.includes("auth/argument-error")) {
throw new MonkeyError(
400,
"Incorrect Bearer token format.",
"authenticateWithBearerToken"
);
} else {
throw error;
}