Display "No entry to save, because no text was received" after empty entry on cmdline (#1459)

* Display "Entry not saved" after empty entry on cmdline
* update error message
This commit is contained in:
Kevin 2022-04-30 12:39:36 -07:00 committed by GitHub
parent d21398ee60
commit d6d6db0aa3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 8 deletions

View file

@ -134,11 +134,9 @@ def write_mode(args, config, journal, **kwargs):
else:
raw = _write_in_editor(config)
if not raw:
logging.error("Write mode: couldn't get raw text")
raise JrnlException(
Message(MsgText.JrnlExceptionMessage.NoTextReceived, MsgType.ERROR)
)
if not raw or raw.isspace():
logging.error("Write mode: couldn't get raw text or entry was empty")
raise JrnlException(Message(MsgText.NoTextReceived, MsgType.ERROR))
logging.debug(
'Write mode: appending raw text to journal "%s": %s', args.journal_name, raw

View file

@ -98,7 +98,7 @@ class MsgText(Enum):
"""
NoTextReceived = """
Nothing saved to file
No entry to save, because no text was received
"""
# --- Upgrade --- #