middleware/error

Members

(async, static) default

Wraps all subsequent async calls to middleware or handlers in a try/catch block to properly handle and format errors prior to sending an error response.

Wraps all subsequent async calls to middleware or handlers in a try/catch block to properly handle and format errors prior to sending an error response. If the caught Error is not a subclass of the ApiException , it is converted into either an InternalException if no status is attached to the error or the < code > status < /code> is 500, or a generic ApiException. The error is logged, the response status is set to the error status, and the response body is set to the error. Finally the error event is emitted on the app.

Source:
See:
  • ApiError
  • InternalError