Description
The existing API routes (/api/bookings, /api/instructors) have minimal
or no error handling. Missing validation and unstructured error responses
make debugging difficult and expose the API to bad inputs.
Current Behavior
- No input validation on
POST /api/bookings
- Generic or no error responses returned
- No HTTP status codes used correctly
- No handling for missing required fields
Expected Behavior
- All required fields validated before processing
- Correct HTTP status codes: 400 (bad input), 404 (not found), 500 (server error)
- Structured JSON error responses:
{ error: "message" }
- Try/catch blocks around all async operations
Acceptance Criteria
Contributing on behalf of NSoC'26 | @Mehren7 please assign me
Description
The existing API routes (
/api/bookings,/api/instructors) have minimalor no error handling. Missing validation and unstructured error responses
make debugging difficult and expose the API to bad inputs.
Current Behavior
POST /api/bookingsExpected Behavior
{ error: "message" }Acceptance Criteria
POST /api/bookings{ error: "..." }JSON responsesContributing on behalf of NSoC'26 | @Mehren7 please assign me