mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-17 11:38:32 +02:00
add new exception handling to 'nothing saved to file' errors
This commit is contained in:
parent
35cdd7bd59
commit
e181302ca4
4 changed files with 8 additions and 4 deletions
|
@ -37,7 +37,7 @@ def get_text_from_editor(config, template=""):
|
|||
os.remove(tmpfile)
|
||||
|
||||
if not raw:
|
||||
print("[Nothing saved to file]", file=sys.stderr)
|
||||
raise JrnlException(JrnlExceptionMessage.NoTextReceived)
|
||||
|
||||
return raw
|
||||
|
||||
|
|
|
@ -51,7 +51,11 @@ class JrnlExceptionMessage(Enum):
|
|||
|
||||
NothingToDelete = """
|
||||
No entries to delete, because the search returned no results.
|
||||
"""
|
||||
"""
|
||||
|
||||
NoTextReceived = """
|
||||
Nothing saved to file.
|
||||
"""
|
||||
|
||||
UpgradeAborted = """
|
||||
jrnl was NOT upgraded
|
||||
|
|
|
@ -136,7 +136,7 @@ def write_mode(args, config, journal, **kwargs):
|
|||
|
||||
if not raw:
|
||||
logging.error("Write mode: couldn't get raw text")
|
||||
sys.exit()
|
||||
raise JrnlException(JrnlExceptionMessage.NoTextReceived)
|
||||
|
||||
logging.debug(
|
||||
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw
|
||||
|
|
|
@ -78,7 +78,7 @@ Feature: Writing new entries.
|
|||
And we write nothing to the editor if opened
|
||||
And we use the password "test" if prompted
|
||||
When we run "jrnl --edit"
|
||||
Then the error output should contain "[Nothing saved to file]"
|
||||
Then the error output should contain "Nothing saved to file"
|
||||
And the editor should have been called
|
||||
|
||||
Examples: configs
|
||||
|
|
Loading…
Add table
Reference in a new issue