fix: Exception message includes unnecessary class args

Fix misusages of ArgumentTypeError which causes a tuple of
class instance and error message string to be printed rather than just the
error message string itsself.

Change-Id: I0e997f86bb6603930cc92e90efcb48155f62ffb5
Closes-bug: #1551426
This commit is contained in:
Jas 2016-02-29 16:06:05 -06:00
parent 5310cfb8b7
commit b8d72cee27

View File

@ -89,7 +89,7 @@ class MultiKeyValueAction(argparse.Action):
else: else:
msg = ("Expected key=value pairs separated by comma, " msg = ("Expected key=value pairs separated by comma, "
"but got: %s" % (str(kv))) "but got: %s" % (str(kv)))
raise argparse.ArgumentTypeError(self, msg) raise argparse.ArgumentTypeError(msg)
# Check key validation # Check key validation
valid_keys = self.required_keys | self.optional_keys valid_keys = self.required_keys | self.optional_keys
@ -160,4 +160,4 @@ class NonNegativeAction(argparse.Action):
setattr(namespace, self.dest, values) setattr(namespace, self.dest, values)
except Exception: except Exception:
msg = "%s expected a non-negative integer" % (str(option_string)) msg = "%s expected a non-negative integer" % (str(option_string))
raise argparse.ArgumentTypeError(self, msg) raise argparse.ArgumentTypeError(msg)