diff options
| author | 2019-11-18 12:06:59 +0000 | |
|---|---|---|
| committer | 2019-11-18 12:06:59 +0000 | |
| commit | 9c4902dcfe2d016b71435ff4be348ea76a1cd7cf (patch) | |
| tree | 2f1c8fd44be3758558c7b56b9672d95c299df1c6 /src | |
| parent | v1.15.0-rc1 release (diff) | |
| signature | ||
"EventsResultsError"->"EventResultsError", move errors to utils.error
Diffstat (limited to 'src')
| -rw-r--r-- | src/utils/__init__.py | 14 | ||||
| -rw-r--r-- | src/utils/errors.py | 12 |
2 files changed, 14 insertions, 12 deletions
diff --git a/src/utils/__init__.py b/src/utils/__init__.py index 294b9083..71e46b82 100644 --- a/src/utils/__init__.py +++ b/src/utils/__init__.py @@ -5,6 +5,8 @@ from . import cli, consts, datetime, decorators, irc, http, parse, security from .decorators import export, hook, kwarg from .settings import (BoolSetting, FunctionSetting, IntRangeSetting, IntSetting, OptionsSetting, sensitive_format, SensitiveSetting, Setting) +from .errors import (EventError, EventsNotEnoughArgsError, EventResultsError, + EventUsageError) class Direction(enum.Enum): Send = 0 @@ -13,18 +15,6 @@ class Direction(enum.Enum): def prevent_highlight(nickname: str) -> str: return nickname[0]+"\u200c"+nickname[1:] -class EventError(Exception): - pass -class EventsResultsError(EventError): - def __init__(self): - EventError.__init__(self, "Failed to load results") -class EventsNotEnoughArgsError(EventError): - def __init__(self, n): - EventError.__init__(self, "Not enough arguments (minimum %d)" % n) -class EventsUsageError(EventError): - def __init__(self, usage): - EventError.__init__(self, "Not enough arguments, usage: %s" % usage) - class MultiCheck(object): def __init__(self, requests: typing.List[typing.Tuple[str, typing.List[str]]]): diff --git a/src/utils/errors.py b/src/utils/errors.py new file mode 100644 index 00000000..7b7720c6 --- /dev/null +++ b/src/utils/errors.py @@ -0,0 +1,12 @@ +class EventError(Exception): + pass +class EventResultsError(EventError): + def __init__(self): + EventError.__init__(self, "Failed to load results") +class EventNotEnoughArgsError(EventError): + def __init__(self, n): + EventError.__init__(self, "Not enough arguments (minimum %d)" % n) +class EventUsageError(EventError): + def __init__(self, usage): + EventError.__init__(self, "Not enough arguments, usage: %s" % usage) + |
