customizable augment_usage_errors
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 17.7k
- Forks
- 2.3k
- Avg merge
- 1d 30m
- Merged PRs (30d)
- 18
Description
I was looking for a global and clean way to process exception raised inside the command callback. Something like flask.errorhandler.
I read a lot of click code and actually it is not easy to customize because it is all built to be use with decorator.
Finally I found augment_usage_errors, a contextmanager used to wrap the command callback.
I think that will be nice to have a way to customize the exception handling and maybe augment_usage_errors is the starting point to do that.
I'm not so confident with the click code thus I'll not propose a PR, but I would hear your comments about this.
Anyway my needs was really stupid: I want to print the exception stack-trace if I am in debug mode otherwise I'll print a coloured one-line message.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading Click's augment_usage_errors context manager and the command callback exception path. Compare the requested global handling with Flask's errorhandler model and determine the intended customization boundary. Done means the issue's debug and one-line colored error-handling needs have a clear, maintainable extension point, with its behavior documented and tested.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- cli
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100