Browse Source

[commands] Raise RuntimeError instead of StopIteration.

pull/105/head
Rapptz 9 years ago
parent
commit
baf1312d0e
  1. 5
      discord/ext/commands/core.py

5
discord/ext/commands/core.py

@ -227,7 +227,7 @@ class Command:
if view.eof: if view.eof:
if param.kind == param.VAR_POSITIONAL: if param.kind == param.VAR_POSITIONAL:
raise StopIteration() # break the loop raise RuntimeError() # break the loop
if required: if required:
raise MissingRequiredArgument('{0.name} is a required argument that is missing.'.format(param)) raise MissingRequiredArgument('{0.name} is a required argument that is missing.'.format(param))
return param.default return param.default
@ -306,8 +306,9 @@ class Command:
try: try:
transformed = yield from self.transform(ctx, param) transformed = yield from self.transform(ctx, param)
args.append(transformed) args.append(transformed)
except StopIteration: except RuntimeError:
break break
except CommandError as e: except CommandError as e:
self.handle_local_error(e, ctx) self.handle_local_error(e, ctx)
ctx.bot.dispatch('command_error', e, ctx) ctx.bot.dispatch('command_error', e, ctx)

Loading…
Cancel
Save