diff --git a/typer/main.py b/typer/main.py index ccf9f0956c..a8a0e994f7 100644 --- a/typer/main.py +++ b/typer/main.py @@ -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 @@ -137,6 +138,7 @@ 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 @@ -144,6 +146,7 @@ def __init__( 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, @@ -321,6 +324,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