Skip to content

Commit

Permalink
Improve error message for In() and NotIn() (#425)
Browse files Browse the repository at this point in the history
* Update validators.py

* Update In and NotIn validator error message
  • Loading branch information
vmaillol-altair authored Nov 18, 2020
1 parent 67adedd commit ffa09b4
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions voluptuous/validators.py
Original file line number Diff line number Diff line change
Expand Up @@ -737,7 +737,8 @@ def __call__(self, v):
except TypeError:
check = True
if check:
raise InInvalid(self.msg or 'value is not allowed')
raise InInvalid(self.msg or
'value must be one of {}'.format(self.container))
return v

def __repr__(self):
Expand All @@ -757,7 +758,8 @@ def __call__(self, v):
except TypeError:
check = True
if check:
raise NotInInvalid(self.msg or 'value is not allowed')
raise NotInInvalid(self.msg or
'value must not be one of {}'.format(self.container))
return v

def __repr__(self):
Expand Down

0 comments on commit ffa09b4

Please sign in to comment.