ErrorHandler

node/errorHandler. ErrorHandler

An error handler that captures uncaught exceptions and unhandled rejections in order to log them with detail.

Constructor

new ErrorHandler(appLogger, exitOnErroropt)

Source:
Tutorials:
Parameters:
Name Type Attributes Default Description
appLogger Logger

To log the detail of the erros.

exitOnError boolean <optional>
true

Whether or not to exit the process after receiving an error.

Members

exitOnError :boolean

Source:

Whether or not the process will exit after receiving an error.

Type:

Methods

handle(error)

Source:

This is called by the process listeners when an uncaught exception is thrown or a rejected promise is not handled. It logs the error on detail. The process exits when after logging an error.

Parameters:
Name Type Description
error Error

The unhandled error.

listen()

Source:

Starts listening for unhandled errors.

stopListening()

Source:

Stops listening for unhandled errors.