Added generic exception classes
This commit is contained in:
parent
d722754f12
commit
4100c38280
1 changed files with 21 additions and 2 deletions
|
|
@ -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."""
|
||||
|
|
|
|||
Loading…
Reference in a new issue