From 17879a7f69c2746b080e696949201e4092c46f4f Mon Sep 17 00:00:00 2001 From: Joscha Date: Mon, 31 May 2021 11:50:20 +0200 Subject: [PATCH] Print box around message for unexpected exceptions --- PFERD/logging.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/PFERD/logging.py b/PFERD/logging.py index 5025d88..1a07b3e 100644 --- a/PFERD/logging.py +++ b/PFERD/logging.py @@ -8,6 +8,7 @@ from typing import AsyncIterator, ContextManager, Iterator, List, Optional from rich.console import Console, RenderGroup from rich.live import Live from rich.markup import escape +from rich.panel import Panel from rich.progress import (BarColumn, DownloadColumn, Progress, TaskID, TextColumn, TimeRemainingColumn, TransferSpeedColumn) from rich.table import Column @@ -170,10 +171,13 @@ class Log: self.error_contd("") self.error_contd(traceback.format_exc()) - self.error_contd(""" + # Our print function doesn't take types other than strings, but the + # underlying rich.print function does. This call is a special case + # anyways, and we're calling it internally, so this should be fine. + self.print(Panel.fit(""" Please copy your program output and send it to the PFERD maintainers, either directly or as a GitHub issue: https://github.com/Garmelon/PFERD/issues/new - """.strip()) + """.strip())) # type: ignore def explain_topic(self, text: str) -> None: """