mirror of
https://github.com/sern-handler/handler
synced 2026-06-24 16:52:15 +00:00
consolidate default services in single file
This commit is contained in:
@@ -1,4 +1,24 @@
|
||||
import { LogPayload, Logging } from '../../interfaces';
|
||||
import type { LogPayload, Logging, ErrorHandling } from '../interfaces';
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -1,4 +1,4 @@
|
||||
export { CommandType, PluginType, PayloadType, EventType } from './enums';
|
||||
export * from './context';
|
||||
export * from './services';
|
||||
export * as __Services from './default-services';
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
import { ErrorHandling } from '../../interfaces';
|
||||
|
||||
/**
|
||||
* @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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,2 +0,0 @@
|
||||
export * from './error-handling';
|
||||
export * from './logger';
|
||||
Reference in New Issue
Block a user