diff options
author | vmaillol-altair <55581329+vmaillol-altair@users.noreply.github.com> | 2020-11-18 20:13:54 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-18 20:13:54 +0100 |
commit | ffa09b4b0668fdc7dba012d8c13ffb35bc83ff79 (patch) | |
tree | 9ec35f13271e522bdf42c62186533622ce023c3a | |
parent | 67adedd627054e151101575c8c5a7d65f72f827a (diff) | |
download | voluptuous-ffa09b4b0668fdc7dba012d8c13ffb35bc83ff79.tar.gz |
Improve error message for In() and NotIn() (#425)
* Update validators.py
* Update In and NotIn validator error message
-rw-r--r-- | voluptuous/validators.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/voluptuous/validators.py b/voluptuous/validators.py index 2add5d1..fd0aa90 100644 --- a/voluptuous/validators.py +++ b/voluptuous/validators.py @@ -737,7 +737,8 @@ class In(object): 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): @@ -757,7 +758,8 @@ class NotIn(object): 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): |