Skip to content

Commit

Permalink
Generalized the wording of BadArgumentFormat
Browse files Browse the repository at this point in the history
  • Loading branch information
epsy committed Feb 21, 2015
1 parent 698b74a commit cc4524b
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions clize/errors.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

from functools import partial

from clize import util


class UserError(ValueError):
"""An error to be printed to the user."""
Expand Down Expand Up @@ -116,14 +114,14 @@ def message(self):
class BadArgumentFormat(ArgumentError):
"""Raised when an argument cannot be converted to the correct format."""

def __init__(self, typ, val):
self.typ = typ
def __init__(self, param, val):
self.param = param
self.val = val

@property
def message(self):
return "Bad format for {0}: {1!r}".format(
util.name_type2cli(self.typ), self.val)
return "Bad value for {0.display_name}: {1!r}".format(
self.param, self.val)


class ArgsBeforeAlternateCommand(ArgumentError):
Expand Down

0 comments on commit cc4524b

Please sign in to comment.