Skip to content

Commit

Permalink
fixed 500 on invalid id
Browse files Browse the repository at this point in the history
  • Loading branch information
pm3512 committed Jan 29, 2024
1 parent 46ebaf8 commit 19450a3
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/controllers/TeamController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,13 @@ export const updateTeamAdmin = async (
res: Response
): Promise<void> => {
const { id, name, description, visible } = req.body;
const team = await getTeamById(new ObjectId(id));

let team;
try {
team = await getTeamById(new ObjectId(id));
} catch (e) {
return bad(res, "Invalid team ID");
}
if (!team) {
return bad(res, "This team does not exist!");
}
Expand Down

0 comments on commit 19450a3

Please sign in to comment.