Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for custom error handling #112

Open
1 task done
ItsMeBrianD opened this issue Jan 11, 2024 · 1 comment · May be fixed by #113
Open
1 task done

Add support for custom error handling #112

ItsMeBrianD opened this issue Jan 11, 2024 · 1 comment · May be fixed by #113

Comments

@ItsMeBrianD
Copy link

Describe the feature

When using subcommands, it would be nice to have error handling bubble up, much like setup and cleanup

Additional information

  • Would you be willing to help implement this feature?
@ItsMeBrianD ItsMeBrianD linked a pull request Jan 11, 2024 that will close this issue
7 tasks
@zzhenryquezz
Copy link

An ideia would be rethrow the error in this line:

citty/src/main.ts

Lines 34 to 36 in fea15c4

if (!isCLIError) {
consola.error(error, "\n");
}

This way:

 if (!isCLIError) { 
   throw error; 
 } 

And then we can handle the error in the main script:

 runMain(main).catch((err) => { 
     // handle error
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants