ErrorHandler

ErrorHandler Class.

This service handles error logging and optionally integrates with Sentry for advanced error tracking. By default, it logs errors using the provided logger. When Sentry is enabled and initialized, errors are also reported to Sentry.

Constructor

new ErrorHandler(options)

Creates an instance of ErrorHandler.

Creates an instance of ErrorHandler.

Parameters:
NameTypeDescription
optionsErrorHandlerOptions

Configuration options for the error handler.

Methods

captureError(error, contextopt)

Captures an error, logs it, and optionally reports it to Sentry.

Captures an error, logs it, and optionally reports it to Sentry.

Parameters:
NameTypeAttributesDefaultDescription
errorError

The error to handle.

contextObject<optional>
{}

Additional context or metadata related to the error.

captureError(error, contextopt)

Captures an error, logs it, and optionally reports it to Sentry.

Captures an error, logs it, and optionally reports it to Sentry.

Parameters:
NameTypeAttributesDefaultDescription
errorError

The error to handle.

contextObject<optional>
{}

Additional context or metadata related to the error.

ErrorHandler

ErrorHandler Class.

This service handles error logging and optionally integrates with Sentry for advanced error tracking. By default, it logs errors using the provided logger. When Sentry is enabled and initialized, errors are also reported to Sentry.

Constructor

new ErrorHandler(options)

Creates an instance of ErrorHandler.

Creates an instance of ErrorHandler.

Parameters:
NameTypeDescription
optionsErrorHandlerOptions

Configuration options for the error handler.

Methods

captureError(error, contextopt)

Captures an error, logs it, and optionally reports it to Sentry.

Captures an error, logs it, and optionally reports it to Sentry.

Parameters:
NameTypeAttributesDefaultDescription
errorError

The error to handle.

contextObject<optional>
{}

Additional context or metadata related to the error.

captureError(error, contextopt)

Captures an error, logs it, and optionally reports it to Sentry.

Captures an error, logs it, and optionally reports it to Sentry.

Parameters:
NameTypeAttributesDefaultDescription
errorError

The error to handle.

contextObject<optional>
{}

Additional context or metadata related to the error.