if there's more than 1 error message, give generic error
This commit is contained in:
parent
8c9bfe9a2d
commit
932d596660
1 changed files with 7 additions and 4 deletions
|
@ -61,15 +61,18 @@ class Module(ModuleManager.BaseModule):
|
||||||
return options
|
return options
|
||||||
|
|
||||||
def _argument_types(self, options, args):
|
def _argument_types(self, options, args):
|
||||||
current_error = None
|
errors = []
|
||||||
|
current_error = first_error = None
|
||||||
for argument_type, value, n, error in options:
|
for argument_type, value, n, error in options:
|
||||||
if not value == None:
|
if not value == None:
|
||||||
return [argument_type, n, value]
|
return [argument_type, n, value]
|
||||||
elif error:
|
elif error:
|
||||||
current_error = error
|
errors.append(error)
|
||||||
elif n > len(args):
|
elif n > len(args):
|
||||||
current_error = "Not enough arguments"
|
errors.append("Not enough arguments")
|
||||||
return [None, -1, current_error or "Invalid arguments"]
|
|
||||||
|
return [None, -1,
|
||||||
|
errors[0] if len(errors) == 1 else "Invalid arguments"]
|
||||||
|
|
||||||
@utils.hook("preprocess.command")
|
@utils.hook("preprocess.command")
|
||||||
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)
|
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)
|
||||||
|
|
Loading…
Reference in a new issue