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':
|
if os.name == 'posix':
|
||||||
raise
|
raise
|
||||||
|
|
||||||
from wk.cfg.main import CRASH_SERVER, ENABLED_UPLOAD_DATA, SUPPORT_MESSAGE
|
from wk.cfg.main import (
|
||||||
from wk.cfg.main import INDENT, WIDTH
|
CRASH_SERVER,
|
||||||
|
ENABLED_UPLOAD_DATA,
|
||||||
|
INDENT,
|
||||||
|
SUPPORT_MESSAGE,
|
||||||
|
WIDTH,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# STATIC VARIABLES
|
# 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
|
# Functions
|
||||||
def abort(prompt='Aborted.', show_prompt=True, return_code=1):
|
def abort(prompt='Aborted.', show_prompt=True, return_code=1):
|
||||||
"""Abort script."""
|
"""Abort script."""
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue