From 65307411f869a2734a363b5dde8014455526b111 Mon Sep 17 00:00:00 2001 From: alin Date: Mon, 21 Oct 2024 14:45:41 +0200 Subject: [PATCH] Add Skip Process Exit Error Custom error to be used for when attempting to prevent Commander Js's call to process.exit() --- .../src/exceptions/SkipProcessExitError.ts | 21 +++++++++++++++++++ packages/cli/src/exceptions/index.ts | 4 ++++ packages/cli/src/index.ts | 2 ++ 3 files changed, 27 insertions(+) create mode 100644 packages/cli/src/exceptions/SkipProcessExitError.ts create mode 100644 packages/cli/src/exceptions/index.ts diff --git a/packages/cli/src/exceptions/SkipProcessExitError.ts b/packages/cli/src/exceptions/SkipProcessExitError.ts new file mode 100644 index 00000000..3debe830 --- /dev/null +++ b/packages/cli/src/exceptions/SkipProcessExitError.ts @@ -0,0 +1,21 @@ +import type { Throwable } from "@aedart/contracts/support/exceptions"; +import { configureCustomError } from "@aedart/support/exceptions"; + +/** + * Skip Process Exit Error + */ +export default class SkipProcessExitError extends Error implements Throwable +{ + /** + * Create new Skip Process Exit Error instance + * + * @param {string} [message] + * @param {ErrorOptions} [options] + */ + constructor(message?: string, options?: ErrorOptions) + { + super(message, options); + + configureCustomError(this); + } +} \ No newline at end of file diff --git a/packages/cli/src/exceptions/index.ts b/packages/cli/src/exceptions/index.ts new file mode 100644 index 00000000..19564177 --- /dev/null +++ b/packages/cli/src/exceptions/index.ts @@ -0,0 +1,4 @@ +import SkipProcessExitError from "./SkipProcessExitError"; +export { + SkipProcessExitError +} \ No newline at end of file diff --git a/packages/cli/src/index.ts b/packages/cli/src/index.ts index 59c8cd2b..eed15e9f 100644 --- a/packages/cli/src/index.ts +++ b/packages/cli/src/index.ts @@ -2,3 +2,5 @@ import CliApplication from "./CliApplication"; export { CliApplication } + +export * from './exceptions/index'; \ No newline at end of file