consolidate default services in single file

This commit is contained in:
Jacob Nguyen
2024-04-28 20:36:50 -05:00
parent f5136ba1ca
commit 9faae7eca7
7 changed files with 24 additions and 38 deletions

View File

@@ -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

View File

@@ -1,4 +1,4 @@
export { CommandType, PluginType, PayloadType, EventType } from './enums';
export * from './context';
export * from './services';
export * as __Services from './default-services';

View File

@@ -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;
}
}
}

View File

@@ -1,2 +0,0 @@
export * from './error-handling';
export * from './logger';