Module: libs/errorHandler


This is the default expection handler module assigned for each router and reporting an error that occurred during HTTP request.

indigo provides the option to override this library from app.json by specifing path to your custom library.

Another option for you is to customize an HTML error details by pointing to your template file. By default indigo rendering template from examples/templates directory.

And last option is the ability to specify a URL link for HTTP errors 400/500/503.

  • 1.0


conf/app.json { ... "errors": { "path": null, "template": null, "404": "", "500": "", "503": "" } ... }


error(errorId, err, message, details){Object}

Logging an error message and assigning an uinque system id for each error.

Name Type Description
errorId String

Error id assigning for each function hanlder.

err Object

Contains information about errors.

message String

Error description.

details String optional

Error details.

JSON object with error infomation.


Error handler of runtime errors during rendering EJS templates.

Name Type Description
err Object

Contains information about errors.

JSON object with error infomation.

json(req, res, errorKey, errorCode)

Utility for output error JSON response on the client REST request.

Name Type Default Description
req express.Request

Defines an object to provide client request information.

res express.Response

Defines an object to assist a server in sending a response to the client.

errorKey String optional

Error code id defined in error.json under locales directory.

errorCode Number 400 optional

HTTP error code.