-
-
Notifications
You must be signed in to change notification settings - Fork 969
✨ Add pretty_exceptions_suppress option to extend suppressed frames in pretty exceptions
#770
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,6 +196,18 @@ $ python main.py | |
|
|
||
| </div> | ||
|
|
||
| ## Suppress Frames from Pretty Exceptions | ||
|
|
||
| By default, typer will **omit** all the parts of the traceback that come from the internal parts in Typer and Click, but you can exclude frames from additional | ||
| frameworks using `pretty_exceptions_suppress`, which should be a list of modules or str paths. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How exactly would "str paths" be defined? |
||
|
|
||
| ```Python | ||
| import typer | ||
| import sqlalchemy | ||
|
|
||
| app = typer.Typer(pretty_exceptions_suppress=[sqlalchemy]) | ||
| ``` | ||
|
|
||
| ## Disable Pretty Exceptions | ||
|
|
||
| You can also entirely disable pretty exceptions with the parameter `pretty_exceptions_enable=False`: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Question: what should happen when both |
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a few things we need to do to improve the docs here:
sqlmodellines in its error stack trace, and the output should be displayed so the user can verify ittests/test_tutorial/test_exceptions, at which point it should check e.g. thatsqlalchemyis part of the output (or not) with the setting off (or on).BTW - is "frames" the correct term here? I would have opted for "Libraries", but I'm not sure either way.