diff --git a/jrnl/jrnl.py b/jrnl/jrnl.py index 7dede648..4e824f85 100644 --- a/jrnl/jrnl.py +++ b/jrnl/jrnl.py @@ -200,11 +200,7 @@ def _get_editor_template(config, **kwargs): logging.debug("Write mode: template loaded: %s", template) except OSError: logging.error("Write mode: template not loaded") - print( - f"[Could not read template at '{config['template']}']", - file=sys.stderr, - ) - sys.exit(1) + raise JrnlException(Message(MsgText.CantReadTemplate, MsgType.ERROR, { "template": config["template"] })) return template diff --git a/jrnl/messages.py b/jrnl/messages.py index 056e1d1f..340e7b69 100644 --- a/jrnl/messages.py +++ b/jrnl/messages.py @@ -61,6 +61,12 @@ class MsgText(Enum): KeyboardInterruptMsg = "Aborted by user" + CantReadTemplate = """ + Unreadable template + Could not read template file at: + {template} + """ + # --- Journal status ---# JournalNotSaved = "Entry NOT saved to journal"