From 2935d2d30ca42165ea2e4ea2f70b8cb860930a17 Mon Sep 17 00:00:00 2001 From: jakub-mrow Date: Sun, 10 Nov 2024 23:19:00 +0100 Subject: [PATCH] BUG-3536 - fix RichHandler not handling exception --- rich/logging.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rich/logging.py b/rich/logging.py index b2624cd54..4f751fd2b 100644 --- a/rich/logging.py +++ b/rich/logging.py @@ -131,7 +131,11 @@ def get_level_text(self, record: LogRecord) -> Text: def emit(self, record: LogRecord) -> None: """Invoked by logging.""" - message = self.format(record) + try: + message = self.format(record) + except Exception: + self.handleError(record) + traceback = None if ( self.rich_tracebacks