[tor-commits] [stem/master] Unrecognized arguments didn't suggest using --help

atagar at torproject.org atagar at torproject.org
Sun Feb 22 02:32:37 UTC 2015


commit d270e36d2fa88bd4c835a494b7a00c33003651de
Author: Damian Johnson <atagar at torproject.org>
Date:   Sat Feb 21 18:31:50 2015 -0800

    Unrecognized arguments didn't suggest using --help
    
    Oops, didn't mean to bypass the catch here. Switching to getopt.GetoptError so
    we'll include that in the message.
---
 run_tests.py                  |    2 +-
 stem/interpreter/arguments.py |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/run_tests.py b/run_tests.py
index d1c8828..bfdd101 100755
--- a/run_tests.py
+++ b/run_tests.py
@@ -348,7 +348,7 @@ def _get_args(argv):
 
     if unrecognized_args:
       error_msg = "aren't recognized arguments" if len(unrecognized_args) > 1 else "isn't a recognized argument"
-      raise ValueError("'%s' %s" % ("', '".join(unrecognized_args), error_msg))
+      raise getopt.GetoptError("'%s' %s" % ("', '".join(unrecognized_args), error_msg))
   except getopt.GetoptError as exc:
     raise ValueError('%s (for usage provide --help)' % exc)
 
diff --git a/stem/interpreter/arguments.py b/stem/interpreter/arguments.py
index 557d29f..d177b83 100644
--- a/stem/interpreter/arguments.py
+++ b/stem/interpreter/arguments.py
@@ -49,7 +49,7 @@ def parse(argv):
 
     if unrecognized_args:
       error_msg = "aren't recognized arguments" if len(unrecognized_args) > 1 else "isn't a recognized argument"
-      raise ValueError("'%s' %s" % ("', '".join(unrecognized_args), error_msg))
+      raise getopt.GetoptError("'%s' %s" % ("', '".join(unrecognized_args), error_msg))
   except getopt.GetoptError as exc:
     raise ValueError('%s (for usage provide --help)' % exc)
 



More information about the tor-commits mailing list