Methods
(inner) Handle(error, response)
All the errors thrown by the application code, in any of the modules, are routed through this method.
Upon receiving an error, the method first runs an identity check.
- If the
erroris of typeClientError, it sends an error response with one of the 4xx status codes. - If the
erroris of typeExternalError, it sends an error response with a424 Failed Dependencystatus code. - If the
erroris of any other type, it's assumed to an internal server error and a500 Internal Server Errorresponse is sent.
Regardless of the error type, each response includes a detailed description, help message and debugging information in the response body.
Parameters:
| Name | Type | Description |
|---|---|---|
error |
Error | The error thrown |
response |
Express.Response | The response object that will be used to communicate the error back to the client |