mirror of
https://github.com/sern-handler/handler
synced 2026-06-06 01:16:55 +00:00
consolidate default services in single file
This commit is contained in:
@@ -5,7 +5,7 @@ export * from './operators';
|
||||
export * as Files from './module-loading';
|
||||
export * from './functions';
|
||||
export { SernError } from './structures/enums';
|
||||
export * as __Services from './structures/services';
|
||||
export { __Services } from './structures';
|
||||
export { useContainerRaw } from './ioc/base';
|
||||
|
||||
export type _Module = {
|
||||
|
||||
@@ -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';
|
||||
@@ -11,7 +11,7 @@
|
||||
* Plugins are reminiscent of middleware in express.
|
||||
*/
|
||||
|
||||
import type { Err, Ok, Result } from 'ts-results-es';
|
||||
import type { Err, Ok } from 'ts-results-es';
|
||||
import type {
|
||||
BothCommand,
|
||||
ButtonCommand,
|
||||
|
||||
@@ -9,15 +9,4 @@ export interface Wrapper {
|
||||
commands: string;
|
||||
defaultPrefix?: string;
|
||||
events?: string;
|
||||
/**
|
||||
* Overload to enable mode in case developer does not use a .env file.
|
||||
* @deprecated - https://github.com/sern-handler/handler/pull/325
|
||||
*/
|
||||
mode?: string
|
||||
/*
|
||||
* @deprecated
|
||||
*/
|
||||
containerConfig?: {
|
||||
get: (...keys: (keyof Dependencies)[]) => unknown[];
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user