mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
22 lines
445 B
TypeScript
22 lines
445 B
TypeScript
import { ErrorHandling } from '../../contracts';
|
|
|
|
/**
|
|
* @internal
|
|
* @since 2.0.0
|
|
* Version 4.0.0 will internalize this api. Please refrain from using the defaults!
|
|
*/
|
|
export class DefaultErrorHandling implements ErrorHandling {
|
|
crash(err: Error): never {
|
|
throw err;
|
|
}
|
|
|
|
#keepAlive = 1;
|
|
|
|
updateAlive(err: Error) {
|
|
this.#keepAlive--;
|
|
if (this.#keepAlive === 0) {
|
|
throw err;
|
|
}
|
|
}
|
|
}
|