Clarify filter error messages
This commit is contained in:
@@ -127,18 +127,19 @@ class Filter(object):
|
||||
ArgumentTypeError will result as well.
|
||||
'''
|
||||
if '=' not in argval:
|
||||
msg = 'filter {0} must have format "NAME=VALUE"'.format(argval)
|
||||
msg = "filter '{0}' must have format 'NAME=VALUE'".format(argval)
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
(name, value_str) = argval.split('=', 1)
|
||||
try:
|
||||
value = self.type(value_str)
|
||||
except ValueError:
|
||||
msg = 'filter {0} must have type {1}'.format(
|
||||
value_str, self.type.__name__)
|
||||
msg = "{0} filter value '{1}' must have type {2}".format(
|
||||
name, value_str, self.type.__name__)
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
if self.choices and value not in self.choices:
|
||||
msg = 'filter value {0} must match one of {1}'.format(
|
||||
value, ', '.join([str(choice) for choice in self.choices]))
|
||||
msg = "{0} filter value '{1}' must match one of {2}".format(
|
||||
name, value,
|
||||
', '.join([str(choice) for choice in self.choices]))
|
||||
raise argparse.ArgumentTypeError(msg)
|
||||
if value == '':
|
||||
value = EMPTY
|
||||
|
||||
Reference in New Issue
Block a user