Skip to content

Add Error Handling Middleware #59

Description

@NhanPhamThanh-IT

Description

The boilerplate currently has basic routes and controllers, but lacks centralized error handling. To make the API more robust:

Tasks:

  • Create an Express error‑handling middleware to catch synchronous and asynchronous errors.
  • Ensure that unexpected errors are not leaking stack traces in production.
  • Standardize error response format (status code, message, possibly error code).
  • Possibly define custom error classes for common error types (NotFound, BadRequest, etc).
  • Ensure validation errors (if added) are handled via this middleware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions