dino-core
Version:
A dependency injection framework for NodeJS applications
41 lines (40 loc) • 1.21 kB
TypeScript
import { ErrorType } from './error.type';
import { Injectable } from './injectable';
/**
* An error handler will be registered and invoked in case of an uncought error or unhandled promise
*
* When contextScan is set to true, classes extending this class will be
* automatically discovered and injected on the application context.
* @typedef {ErrorHandler}
*
* @public
* @abstract
*
* @class ErrorHandler
* @since 0.4.7
*/
export declare abstract class ErrorHandler extends Injectable {
/**
* Lifecycle hook allows to execute initialization steps for a component behaviour.
*
* @public
*/
postConstruct(): void;
/**
* Lifecycle hook allows to execute initialization steps for a component behaviour.
*
* @public
*/
preDestroy(): void;
/**
* Handler for the uncaught error, in its basic form the method is empty and
* just logs the received error.
* Extend it to include your logic
* @param {Error} error the error that has been caught
* @param {ErrorType} type the type of error that has been caught
*
* @public
*/
handle(error: Error, type: string | ErrorType): void;
getTypeName(): string;
}