Skip to content

Commit 2587d6d

Browse files
committed
add pretty_exceptions_width in Typer class
add `pretty_exceptions_width` in typer class to be used by `DeveloperConfigException` to allow setting width of traceback boxes.
1 parent f20336c commit 2587d6d

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

typer/main.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ def except_hook(
7575
exc.__traceback__,
7676
show_locals=exception_config.pretty_exceptions_show_locals,
7777
suppress=supress_internal_dir_names,
78+
width=exception_config.pretty_exceptions_width,
7879
)
7980
console_stderr.print(rich_tb)
8081
return
@@ -139,13 +140,15 @@ def __init__(
139140
pretty_exceptions_enable: bool = True,
140141
pretty_exceptions_show_locals: bool = True,
141142
pretty_exceptions_short: bool = True,
143+
pretty_exceptions_width: int = 100,
142144
):
143145
self._add_completion = add_completion
144146
self.rich_markup_mode: MarkupMode = rich_markup_mode
145147
self.rich_help_panel = rich_help_panel
146148
self.pretty_exceptions_enable = pretty_exceptions_enable
147149
self.pretty_exceptions_show_locals = pretty_exceptions_show_locals
148150
self.pretty_exceptions_short = pretty_exceptions_short
151+
self.pretty_exceptions_width = pretty_exceptions_width
149152
self.info = TyperInfo(
150153
name=name,
151154
cls=cls,
@@ -323,6 +326,7 @@ def __call__(self, *args: Any, **kwargs: Any) -> Any:
323326
pretty_exceptions_enable=self.pretty_exceptions_enable,
324327
pretty_exceptions_show_locals=self.pretty_exceptions_show_locals,
325328
pretty_exceptions_short=self.pretty_exceptions_short,
329+
pretty_exceptions_width=self.pretty_exceptions_width,
326330
),
327331
)
328332
raise e

0 commit comments

Comments
 (0)