middleware/error

Error middleware. It logs the error and sends an appropriate response to the client.
Description:
  • Error middleware. It logs the error and sends an appropriate response to the client.
Source:

Requires

Methods

(static) errorMiddleware(err, req, res) → {void}

Description:
  • Error middleware function. This function handles errors that occur during the request-response cycle. It logs the error and sends an appropriate response to the client.
Source:
Parameters:
Name Type Description
err Object Error object. It may have a resCode and logCode properties.
Properties
Name Type Description
resCode string The response code for the error.
logCode string The log code for the error.
req Object The request object.
res Object The response object.
Returns:
- Returns nothing. It sends a response to the client.
Type
void