move SpecTypeErro to utils.parse.spec

This commit is contained in:
jesopo 2020-02-14 22:03:53 +00:00
parent ab892c33b5
commit 275f896ed8
3 changed files with 7 additions and 6 deletions

View file

@ -53,7 +53,7 @@ class Module(ModuleManager.BaseModule):
if func: if func:
try: try:
value, n = func(server, channel, user, args) value, n = func(server, channel, user, args)
except types.SpecTypeError as e: except utils.parse.SpecTypeError as e:
error = e.message error = e.message
options.append([argument_type, value, n, error]) options.append([argument_type, value, n, error])

View file

@ -1,8 +1,4 @@
from src.utils.parse import SpecTypeError
class SpecTypeError(Exception):
def __init__(self, message: str, arg_count: int=1):
self.message = message
self.arg_count = arg_count
TYPES = {} TYPES = {}
def _type(func): def _type(func):

View file

@ -3,6 +3,11 @@ from .time import duration
from .types import try_int from .types import try_int
from src.utils.datetime.parse import date_human from src.utils.datetime.parse import date_human
class SpecTypeError(Exception):
def __init__(self, message: str, arg_count: int=1):
self.message = message
self.arg_count = arg_count
class SpecArgumentContext(enum.IntFlag): class SpecArgumentContext(enum.IntFlag):
CHANNEL = 1 CHANNEL = 1
PRIVATE = 2 PRIVATE = 2