From 4100c382807f4522b8984de446457c75f2e0498f Mon Sep 17 00:00:00 2001 From: 2Shirt <2xShirt@gmail.com> Date: Fri, 9 Aug 2019 20:34:05 -0600 Subject: [PATCH] Added generic exception classes --- scripts/wk/std.py | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/scripts/wk/std.py b/scripts/wk/std.py index f9dc4a45..ca1bd360 100644 --- a/scripts/wk/std.py +++ b/scripts/wk/std.py @@ -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."""