aboutsummaryrefslogtreecommitdiff
path: root/src/core_modules/command_spec
diff options
context:
space:
mode:
authorGravatar jesopo2020-02-27 18:00:13 +0000
committerGravatar jesopo2020-02-27 18:00:13 +0000
commit932d5966602d3da16b3e614b7ae880e3236a7c89 (patch)
tree9e2327d081d7ad6049976fdc604da848f8ff69b4 /src/core_modules/command_spec
parent`insert` decorator kwargs because decorators are run innermost first (diff)
signature
if there's more than 1 error message, give generic error
Diffstat (limited to 'src/core_modules/command_spec')
-rw-r--r--src/core_modules/command_spec/__init__.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core_modules/command_spec/__init__.py b/src/core_modules/command_spec/__init__.py
index d54c433b..196afbd6 100644
--- a/src/core_modules/command_spec/__init__.py
+++ b/src/core_modules/command_spec/__init__.py
@@ -61,15 +61,18 @@ class Module(ModuleManager.BaseModule):
return options
def _argument_types(self, options, args):
- current_error = None
+ errors = []
+ current_error = first_error = None
for argument_type, value, n, error in options:
if not value == None:
return [argument_type, n, value]
elif error:
- current_error = error
+ errors.append(error)
elif n > len(args):
- current_error = "Not enough arguments"
- return [None, -1, current_error or "Invalid arguments"]
+ errors.append("Not enough arguments")
+
+ return [None, -1,
+ errors[0] if len(errors) == 1 else "Invalid arguments"]
@utils.hook("preprocess.command")
@utils.kwarg("priority", EventManager.PRIORITY_HIGH)