-
Notifications
You must be signed in to change notification settings - Fork 17
Open
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed
Description
Issue
For token based auth, when a token is not valid or not provided, the api returns a 500 error.
Sending a 401 would be more appropriate plus, can help students to identify easier why their requests failed.
Solution
In error-handling\index.js, we can improve error handling adding the following:
//Unauthorized
if (err.name === "UnauthorizedError") {
res.status(401).json({ message: `Unauthorized: ${err.inner?.message}` });
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomershelp wantedExtra attention is neededExtra attention is needed

