Added generic exception classes

This commit is contained in:
2Shirt 2019-08-09 20:34:05 -06:00
parent d722754f12
commit 4100c38280
Signed by: 2Shirt
GPG key ID: 152FAC923B0E132C

View file

@ -20,8 +20,13 @@ except ImportError:
if os.name == 'posix':
raise
from wk.cfg.main import CRASH_SERVER, ENABLED_UPLOAD_DATA, SUPPORT_MESSAGE
from wk.cfg.main import INDENT, WIDTH
from wk.cfg.main import (
CRASH_SERVER,
ENABLED_UPLOAD_DATA,
INDENT,
SUPPORT_MESSAGE,
WIDTH,
)
# STATIC VARIABLES
@ -41,6 +46,20 @@ REGEX_SIZE_STRING = re.compile(
)
# Exception Classes
class GenericAbort(Exception):
"""Exception used for aborts selected by the user at runtime."""
class GenericError(Exception):
"""Exception used when the built-in exceptions don't fit."""
class GenericWarning(Exception):
"""Exception used to highlight non-critical events.
NOTE: Avoiding built-in warning exceptions in case the
warnings filter has been changed from the default.
"""
# Functions
def abort(prompt='Aborted.', show_prompt=True, return_code=1):
"""Abort script."""