From 691546588c7c7776b0e4e8b3d0a178dd5f87073c Mon Sep 17 00:00:00 2001 From: Jonathan Wren Date: Sat, 12 Mar 2022 15:05:02 -0800 Subject: [PATCH] update uncaught exception for new handling --- jrnl/cli.py | 17 +++++++++++------ jrnl/messages.py | 2 +- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/jrnl/cli.py b/jrnl/cli.py index eea9e97c..cd33f2ec 100644 --- a/jrnl/cli.py +++ b/jrnl/cli.py @@ -7,9 +7,12 @@ import traceback from .jrnl import run from .args import parse_args -from .exception import JrnlException from jrnl.output import print_msg -from jrnl.output import Message + +from jrnl.exception import JrnlException +from jrnl.messages import Message +from jrnl.messages import MsgText +from jrnl.messages import MsgType def configure_logger(debug=False): @@ -61,11 +64,13 @@ def cli(manual_args=None): print("\n") traceback.print_tb(sys.exc_info()[2]) - file_issue = ( - "\n\nThis is probably a bug. Please file an issue at:" - + "\nhttps://github.com/jrnl-org/jrnl/issues/new/choose" + print_msg( + Message( + MsgText.UncaughtException, + MsgType.ERROR, + {"name": type(e).__name__, "exception": e}, + ) ) - print_msg(f"{type(e).__name__}\n", f"{e}{file_issue}", msg=Message.ERROR) # This should be the only exit point return status_code diff --git a/jrnl/messages.py b/jrnl/messages.py index 6b94738f..e6a1933a 100644 --- a/jrnl/messages.py +++ b/jrnl/messages.py @@ -26,7 +26,7 @@ class MsgText(Enum): # --- Exceptions ---# UncaughtException = """ - ERROR + {name} {exception} This is probably a bug. Please file an issue at: