mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 19:48:31 +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)
|
logging.debug("Write mode: template loaded: %s", template)
|
||||||
except OSError:
|
except OSError:
|
||||||
logging.error("Write mode: template not loaded")
|
logging.error("Write mode: template not loaded")
|
||||||
print(
|
raise JrnlException(Message(MsgText.CantReadTemplate, MsgType.ERROR, { "template": config["template"] }))
|
||||||
f"[Could not read template at '{config['template']}']",
|
|
||||||
file=sys.stderr,
|
|
||||||
)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
return template
|
return template
|
||||||
|
|
||||||
|
|
|
@ -61,6 +61,12 @@ class MsgText(Enum):
|
||||||
|
|
||||||
KeyboardInterruptMsg = "Aborted by user"
|
KeyboardInterruptMsg = "Aborted by user"
|
||||||
|
|
||||||
|
CantReadTemplate = """
|
||||||
|
Unreadable template
|
||||||
|
Could not read template file at:
|
||||||
|
{template}
|
||||||
|
"""
|
||||||
|
|
||||||
# --- Journal status ---#
|
# --- Journal status ---#
|
||||||
JournalNotSaved = "Entry NOT saved to journal"
|
JournalNotSaved = "Entry NOT saved to journal"
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue