Skip to content

Commit

Permalink
Add Skip Process Exit Error
Browse files Browse the repository at this point in the history
Custom error to be used for when attempting to prevent Commander Js's call to process.exit()
  • Loading branch information
aedart committed Oct 21, 2024
1 parent 0909869 commit 6530741
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
21 changes: 21 additions & 0 deletions packages/cli/src/exceptions/SkipProcessExitError.ts
Original file line number Diff line number Diff line change
@@ -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);
}
}
4 changes: 4 additions & 0 deletions packages/cli/src/exceptions/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import SkipProcessExitError from "./SkipProcessExitError";
export {
SkipProcessExitError
}
2 changes: 2 additions & 0 deletions packages/cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,5 @@ import CliApplication from "./CliApplication";
export {
CliApplication
}

export * from './exceptions/index';

0 comments on commit 6530741

Please sign in to comment.