Skip to content

Commit

Permalink
Fixing error code to return correct error rather than 500.
Browse files Browse the repository at this point in the history
500 was being thrown due to a missing method _jsonify.
  • Loading branch information
glenrobson committed Sep 17, 2018
1 parent 97625e1 commit 0a9f29f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions iiif_validator/validator.py
Original file line number Diff line number Diff line change
Expand Up @@ -456,8 +456,10 @@ def empty_response(self, *args, **kwargs):

def error(self, error, message=None):
"""Returns the error response."""
return self._jsonify({"error": error.status_code,
"message": error.body or message}, "")
data = json.dumps({"error": error.status_code, "message": error.body or message})
# add content-type and CORS headers to error
self.after_request()
return data

def get_error_handler(self):
"""Customized errors"""
Expand Down

0 comments on commit 0a9f29f

Please sign in to comment.