|
19 | 19 | from typing_extensions import Literal
|
20 | 20 |
|
21 | 21 | from zulipterminal.api_types import Composition, Message
|
| 22 | +from zulipterminal.config.keys import primary_display_key_for_command |
22 | 23 | from zulipterminal.config.symbols import POPUP_CONTENT_BORDER, POPUP_TOP_LINE
|
23 | 24 | from zulipterminal.config.themes import ThemeSpec
|
24 | 25 | from zulipterminal.config.ui_sizes import (
|
|
35 | 36 | EditHistoryView,
|
36 | 37 | EditModeView,
|
37 | 38 | EmojiPickerView,
|
| 39 | + ExceptionView, |
38 | 40 | FullRawMsgView,
|
39 | 41 | FullRenderedMsgView,
|
40 | 42 | HelpView,
|
@@ -300,6 +302,11 @@ def show_stream_members(self, stream_id: int) -> None:
|
300 | 302 | def popup_with_message(self, text: str, width: int) -> None:
|
301 | 303 | self.show_pop_up(NoticeView(self, text, width, "NOTICE"), "area:error")
|
302 | 304 |
|
| 305 | + def show_exception_popup(self, text: str, width: int, traceback: str) -> None: |
| 306 | + self.show_pop_up( |
| 307 | + ExceptionView(self, text, width, "EXCEPTION", traceback), "area:error" |
| 308 | + ) |
| 309 | + |
303 | 310 | def show_about(self) -> None:
|
304 | 311 | self.show_pop_up(
|
305 | 312 | AboutView(
|
@@ -709,8 +716,12 @@ def _raise_exception(self, *args: Any, **kwargs: Any) -> Literal[True]:
|
709 | 716 | + "\n\n"
|
710 | 717 | + "Details of the exception can be found in "
|
711 | 718 | + exception_logfile
|
| 719 | + + "\n\n" |
| 720 | + + f"Press [{primary_display_key_for_command('COPY_TRACEBACK')}]" |
| 721 | + + " to copy traceback to clipboard." |
712 | 722 | )
|
713 |
| - self.popup_with_message(message, width=80) |
| 723 | + full_traceback = "".join(traceback.format_exception(*exc)) |
| 724 | + self.show_exception_popup(message, traceback=full_traceback, width=80) |
714 | 725 | self._exception_info = None
|
715 | 726 | return True # If don't raise, retain pipe
|
716 | 727 |
|
|
0 commit comments