-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Does python-fire have some method to do unified exception handling? #142
Comments
Came here looking for the same (as I knew click had it). Couldn't find anything in docs/examples, so I guess it leaves that part to the user? |
That's correct. If there's an error caused by the user's usage (e.g. they try to access a command that doesn't exist, or don't provide required arguments for a command), then internally Fire raises a If there's a Python error in the CLI, then Fire doesn't catch it; it simply surfaces to the user as a Python error. You can certainly catch errors raised by CLI (both ordinary Python errors as well as |
Here's the real answer to your question: Yes, Fire catches So e.g. you can do something like
Then when you use it you'll see:
Sorry it's not in the docs yet! |
Answered in previous comment; closing! |
No description provided.
The text was updated successfully, but these errors were encountered: