Skip to content

Commit 01aefba

Browse files
committed
feat: install Rich's global exception handler for improved error reporting
Added installation of Rich's global exception handler to route tracebacks to stderr instead of stdout. This change enhances error diagnostics by preventing mixing of normal output with error messages.
1 parent 7179309 commit 01aefba

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/mcpm/cli.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
from rich.console import Console
99
from rich.traceback import Traceback
10+
from rich.traceback import install as install_rich_traceback
1011

1112
from mcpm.clients.client_config import ClientConfigManager
1213
from mcpm.commands import (
@@ -38,6 +39,10 @@
3839
# Setup Rich logging early - this runs when the module is imported
3940
setup_logging()
4041

42+
# Install Rich's global exception handler to use stderr instead of stdout
43+
# This prevents Rich/rich-gradient from routing tracebacks to stdout
44+
install_rich_traceback(console=err_console, show_locals=True)
45+
4146
# Custom context settings to handle main command help specially
4247
CONTEXT_SETTINGS: Dict[str, Any] = dict(help_option_names=[])
4348

0 commit comments

Comments
 (0)