mirror of https://github.com/Textualize/rich.git
Put an exception handler around console.print
This is to handle any failures in the print method and defer exception handling to the Handler.handleErrors method.
This commit is contained in:
parent
5876f5cacc
commit
137adbabf8
|
@ -150,7 +150,10 @@ class RichHandler(Handler):
|
||||||
log_renderable = self.render(
|
log_renderable = self.render(
|
||||||
record=record, traceback=traceback, message_renderable=message_renderable
|
record=record, traceback=traceback, message_renderable=message_renderable
|
||||||
)
|
)
|
||||||
self.console.print(log_renderable)
|
try:
|
||||||
|
self.console.print(log_renderable)
|
||||||
|
except Exception:
|
||||||
|
self.handleError(record)
|
||||||
|
|
||||||
def render_message(self, record: LogRecord, message: str) -> "ConsoleRenderable":
|
def render_message(self, record: LogRecord, message: str) -> "ConsoleRenderable":
|
||||||
"""Render message text in to Text.
|
"""Render message text in to Text.
|
||||||
|
|
Loading…
Reference in New Issue