DegreePrerequisiteTracker / Degree-Prerequisite-Tracker

2 stars 4 forks source link

Fix error when department does not exist #82

Open Nathan-Lackie opened 6 days ago

Nathan-Lackie commented 6 days ago

Currently, when requesting a department with an ID that does not exist, an error is thrown due to no rows being returned. This should instead gracefully error, and return a 404 to the user.

We should also validate that the URL param is a valid number, and return a 400 when it is not.

https://github.com/DegreePrerequisiteTracker/Degree-Prerequisite-Tracker/blob/main/src/api/departments.ts#L31C1-L42C4