Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Improve error message handling

  • Loading branch information...
commit c9fa7623ff31d585c91cd37fa0d919bb91775dae 1 parent 5599bff
@ymage authored
Showing with 5 additions and 5 deletions.
  1. +5 −5 cornice/validators.py
View
10 cornice/validators.py 100644 → 100755
@@ -34,14 +34,14 @@ def _validate_fields(location, data):
request.errors.add(location, attr.name,
"%s is missing" % attr.name)
else:
- if not attr.name in data:
- request.validated[attr.name] = attr.missing
- continue
try:
- deserialized = attr.deserialize(data[attr.name])
+ if not attr.name in data:
+ deserialized = attr.deserialize(None)
+ else:
+ deserialized = attr.deserialize(data[attr.name])
except Invalid, e:
# the struct is invalid
- request.errors.add(location, attr.name, e.msg)
+ request.errors.add(location, attr.name, e.asdict()[attr.name])
else:
request.validated[attr.name] = deserialized
Please sign in to comment.
Something went wrong with that request. Please try again.