mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2026-01-11 18:04:27 +08:00
added another custom error handler
changed returned code
This commit is contained in:
parent
2aa95b4526
commit
2dd1baac95
1 changed files with 7 additions and 1 deletions
|
|
@ -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;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue