Previously we had an unhandled exception that resulted in a 500 (Internal
Server Error) result and a stack trace when an invalid JSON file was
submitted in a POST/PUT request. Change to catching the exception and
returning a 400 (Bad Request) result.
bug
1102391
Change-Id: I7dde33ae732d9addbf988b1d36d4f06eacb634bf
Signed-off-by: Zane Bitter <zbitter@redhat.com>
return False
def from_json(self, datastring):
- return json.loads(datastring)
+ try:
+ return json.loads(datastring)
+ except ValueError as ex:
+ raise webob.exc.HTTPBadRequest(str(ex))
def default(self, request):
if self.has_body(request):