Skip to content

Commit

Permalink
Merge pull request #14 from hfaran/dev
Browse files Browse the repository at this point in the history
Return 400 on ValidationError
  • Loading branch information
hfaran committed Feb 6, 2014
2 parents 2002cf9 + 6e8969d commit 18229de
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions tornado_json/requesthandlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ def write_error(self, status_code, **kwargs):
# with log_message only written if debug mode is enabled
exception = kwargs["exc_info"][1]
if any(isinstance(exception, c) for c in [APIError, ValidationError]):
# ValidationError is always due to a malformed request
if isinstance(exception, ValidationError):
self.set_status(400)
self.fail(exception.log_message if
hasattr(exception, "log_message") else str(exception))
else:
Expand Down

0 comments on commit 18229de

Please sign in to comment.