update upgrade module to properly use new message and exception handling

This commit is contained in:
Jonathan Wren 2022-05-01 04:10:20 -07:00
parent 8088083737
commit 9c030ac790
2 changed files with 4 additions and 3 deletions

View file

@ -131,6 +131,8 @@ class MsgText(Enum):
UpgradeAborted = "jrnl was NOT upgraded"
AbortingUpgrade = "Aborting upgrade..."
ImportAborted = "Entries were NOT imported"
# -- Config --- #

View file

@ -152,9 +152,8 @@ older versions of jrnl anymore.
failed_journals = [j for j in all_journals if not j.validate_parsing()]
if len(failed_journals) > 0:
print_msg("Aborting upgrade.", msg=Message.NORMAL)
raise JrnlException(
Message(MsgText.AbortingUpgrade, MsgType.WARNING),
Message(
MsgText.JournalFailedUpgrade,
MsgType.ERROR,
@ -162,7 +161,7 @@ older versions of jrnl anymore.
"s": "s" if len(failed_journals) > 1 else "",
"failed_journals": "\n".join(j.name for j in failed_journals),
},
)
),
)
# write all journals - or - don't