Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .bass/issue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Implement centralized error handling middleware

Build a centralized error handler that catches all errors and returns consistent JSON responses with appropriate HTTP status codes (e.g., 400 for validation errors, 404 for missing resources, 500 for unexpected errors).

Acceptance Criteria:
- All errors are returned as JSON objects with `message` and optionally `code`
- Unhandled routes return 404 Not Found with JSON body
- Validation errors return 400 Bad Request with JSON body

Test Cases:
- Unit: Throwing a custom 404 error returns { "message": "..." } with status 404
- Unit: Throwing a validation error returns { "message": "..." } with status 400
- Edge: An unhandled exception returns 500 with a generic error message

Please implement this fix.
Loading