Преглед на файлове

Better error when missing argument to preparse option. Closes #1860

Ask Solem преди 11 години
родител
ревизия
c7c2d326a9
променени са 1 файла, в които са добавени 6 реда и са изтрити 1 реда
  1. 6 1
      celery/bin/base.py

+ 6 - 1
celery/bin/base.py

@@ -530,7 +530,12 @@ class Command(object):
                 opt = opts.get(arg)
                 if opt:
                     if opt.takes_value():
-                        acc[opt.dest] = args[index + 1]
+                        try:
+                            acc[opt.dest] = args[index + 1]
+                        except IndexError:
+                            raise ValueError(
+                                'Missing required argument for {0}'.format(
+                                    arg))
                         index += 1
                     elif opt.action == 'store_true':
                         acc[opt.dest] = True