revert removal of crash method and mark deprecated

This commit is contained in:
Jacob Nguyen
2023-05-19 20:48:38 -05:00
parent a6db21c720
commit 49fb1453a5
4 changed files with 12 additions and 2 deletions

View File

@@ -22,7 +22,8 @@
"build:prod": "tsup --minify",
"publish": "npm run build:prod",
"pretty": "prettier --write .",
"test": "vitest"
"tdd" : "vitest",
"test": "vitest --run"
},
"keywords": [
"sern-handler",

View File

@@ -7,6 +7,11 @@ export interface ErrorHandling {
*/
keepAlive: number;
/**
* @deprecated
* Version 4 will remove this method
*/
crash(err :Error) : never
/**
* A function that is called on every crash. Updates keepAlive.
* If keepAlive is 0, the process crashes.

View File

@@ -6,6 +6,10 @@ import { ErrorHandling } from '../../contracts';
* Version 4.0.0 will internalize this api. Please refrain from using ModuleStore!
*/
export class DefaultErrorHandling implements ErrorHandling {
crash(err: Error): never {
throw err;
}
keepAlive = 5;

View File

@@ -6,7 +6,7 @@ import { CommandType } from '../enums';
/**
* @internal
* @since 2.0.0
* Version 4.0.0 will internalize this api. Please refrain from using ModuleStore!
* Version 4.0.0 will internalize this api. Please refrain from using DefaultModuleManager!
*/
export class DefaultModuleManager implements ModuleManager {
constructor(private moduleStore: CoreModuleStore) {}