citty
citty copied to clipboard
Add support for custom error handling
Describe the feature
When using subcommands, it would be nice to have error handling bubble up, much like setup and cleanup
Additional information
- [X] Would you be willing to help implement this feature?
An ideia would be rethrow the error in this line:
https://github.com/unjs/citty/blob/fea15c4b02cebd5f454908bad4b6b7ba694ee9ca/src/main.ts#L34-L36
This way:
if (!isCLIError) {
throw error;
}
And then we can handle the error in the main script:
runMain(main).catch((err) => {
// handle error
})