Skip to content

Commit

Permalink
Rework exitOverride description (#2098)
Browse files Browse the repository at this point in the history
* Rework exitOverride description

* Fix description to match implementation

* Tweak wording again

* Take out the first in case people think it is before displaying helper/error.
  • Loading branch information
shadowspawn authored Dec 12, 2023
1 parent d8a0938 commit 12a8b47
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -1094,8 +1094,9 @@ program.error('Custom processing has failed', { exitCode: 2, code: 'my.custom.er
By default, Commander calls `process.exit` when it detects errors, or after displaying the help or version. You can override
this behaviour and optionally supply a callback. The default override throws a `CommanderError`.

The override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`. The default override behaviour is to throw the error, except for async handling of executable subcommand completion which carries on. The normal display of error messages or version or help
is not affected by the override which is called after the display.
The override callback is passed a `CommanderError` with properties `exitCode` number, `code` string, and `message`.
Commander expects the callback to terminate the normal program flow, and will call `process.exit` if the callback returns.
The normal display of error messages or version or help is not affected by the override which is called after the display.

```js
program.exitOverride();
Expand Down

0 comments on commit 12a8b47

Please sign in to comment.