Skip to content

Commit

Permalink
add pretty_exceptions_width in Typer class
Browse files Browse the repository at this point in the history
add `pretty_exceptions_width` in typer class to be used by
`DeveloperConfigException` to allow setting width of traceback
boxes.
  • Loading branch information
indiVar0508 committed Mar 15, 2024
1 parent 15f1b59 commit 8160ea7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions typer/main.py
Expand Up @@ -75,6 +75,7 @@ def except_hook(
exc.__traceback__,
show_locals=exception_config.pretty_exceptions_show_locals,
suppress=supress_internal_dir_names,
width=exception_config.pretty_exceptions_width,
)
console_stderr.print(rich_tb)
return
Expand Down Expand Up @@ -139,13 +140,15 @@ def __init__(
pretty_exceptions_enable: bool = True,
pretty_exceptions_show_locals: bool = True,
pretty_exceptions_short: bool = True,
pretty_exceptions_width: int = 100,
):
self._add_completion = add_completion
self.rich_markup_mode: MarkupMode = rich_markup_mode
self.rich_help_panel = rich_help_panel
self.pretty_exceptions_enable = pretty_exceptions_enable
self.pretty_exceptions_show_locals = pretty_exceptions_show_locals
self.pretty_exceptions_short = pretty_exceptions_short
self.pretty_exceptions_width = pretty_exceptions_width
self.info = TyperInfo(
name=name,
cls=cls,
Expand Down Expand Up @@ -323,6 +326,7 @@ def __call__(self, *args: Any, **kwargs: Any) -> Any:
pretty_exceptions_enable=self.pretty_exceptions_enable,
pretty_exceptions_show_locals=self.pretty_exceptions_show_locals,
pretty_exceptions_short=self.pretty_exceptions_short,
pretty_exceptions_width=self.pretty_exceptions_width,
),
)
raise e
Expand Down

0 comments on commit 8160ea7

Please sign in to comment.