mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
replace sys.exit call with new exception handling
This commit is contained in:
parent
66ce8debe5
commit
6a4915c393
2 changed files with 7 additions and 5 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue