Return bad request for Tryton exception instead of internal error
Those exceptions are expected behavior so it is the fault of the client, not the server. issue8768 review276221002
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Return 400 instead of 500 for Tryton exception
|
||||
* Fill the reverse field in the One2Many setter
|
||||
* Drop support for skiptest attribute on xml files
|
||||
* Remove implicit field names in ModelStorage.search_read
|
||||
|
||||
@@ -153,7 +153,9 @@ class JSONProtocol:
|
||||
else:
|
||||
response['result'] = data
|
||||
else:
|
||||
if isinstance(data, Exception):
|
||||
if isinstance(data, TrytonException):
|
||||
return BadRequest(data)
|
||||
elif isinstance(data, Exception):
|
||||
return InternalServerError(data)
|
||||
response = data
|
||||
return Response(json.dumps(
|
||||
|
||||
@@ -153,6 +153,8 @@ class XMLProtocol:
|
||||
data, methodresponse=True, allow_none=True),
|
||||
content_type='text/xml')
|
||||
else:
|
||||
if isinstance(data, Exception):
|
||||
if isinstance(data, TrytonException):
|
||||
return BadRequest(data)
|
||||
elif isinstance(data, Exception):
|
||||
return InternalServerError(data)
|
||||
return Response(data)
|
||||
|
||||
Reference in New Issue
Block a user