mirror of
https://github.com/jrnl-org/jrnl.git
synced 2025-05-10 08:38:32 +02:00
* Update and modularize exception handling cc #1024 #1141 - Stack traces are no longer shown to users unless the --debug flag is being used - Errors, warnings, and other messages contain color as needed - Converted error messages to Enum - Adds print_msg function to centralize output (this should replace all other output in other modules) Co-authored-by: Micah Jerome Ellison <micah.jerome.ellison@gmail.com>
25 lines
595 B
Python
25 lines
595 B
Python
# Copyright (C) 2012-2021 jrnl contributors
|
|
# License: https://www.gnu.org/licenses/gpl-3.0.html
|
|
from jrnl.messages import Message
|
|
from jrnl.output import print_msg
|
|
|
|
|
|
class UserAbort(Exception):
|
|
pass
|
|
|
|
|
|
class UpgradeValidationException(Exception):
|
|
"""Raised when the contents of an upgraded journal do not match the old journal"""
|
|
|
|
pass
|
|
|
|
|
|
class JrnlException(Exception):
|
|
"""Common exceptions raised by jrnl."""
|
|
|
|
def __init__(self, *messages: Message):
|
|
self.messages = messages
|
|
|
|
def print(self) -> None:
|
|
for msg in self.messages:
|
|
print_msg(msg)
|