Skip to content
Snippets Groups Projects
Commit df46e561 authored by Ugo Albanese's avatar Ugo Albanese
Browse files

Merged in rosexceptions-json-NRRPLT-8139 (pull request #120)

[NRRPLT-8139] Fix rospy Exception not being serializable.

Approved-by: Stefano Nardo
Approved-by: Krzysztof Lebioda
parent 43cc1ece
No related branches found
No related tags found
No related merge requests found
...@@ -26,7 +26,6 @@ This module contains the error handlers for the REST server. ...@@ -26,7 +26,6 @@ This module contains the error handlers for the REST server.
For 500 errors, a json object understandable by the HBP For 500 errors, a json object understandable by the HBP
frontend libraries is returned. frontend libraries is returned.
""" """
#from builtins import str
__author__ = 'GeorgHinkel' __author__ = 'GeorgHinkel'
...@@ -88,4 +87,4 @@ def error2json(error): ...@@ -88,4 +87,4 @@ def error2json(error):
logger.exception(error) logger.exception(error)
return json.dumps({'message': error.message, return json.dumps({'message': error.message,
'type': error.error_type, 'type': error.error_type,
'data': error.data}), error.error_code 'data': str(error.data) if error.data else None}), error.error_code
...@@ -81,7 +81,6 @@ class TestSimulationRecorder(RestTest): ...@@ -81,7 +81,6 @@ class TestSimulationRecorder(RestTest):
simulations[0].cle.command_simulation_recorder.side_effect = ROSCLEClientException('foo') simulations[0].cle.command_simulation_recorder.side_effect = ROSCLEClientException('foo')
response = self.client.get('/simulation/0/recorder/is-recording') response = self.client.get('/simulation/0/recorder/is-recording')
self.assertEqual(500, response.status_code) self.assertEqual(500, response.status_code)
self.assertDictEqual( self.assertDictEqual(
json.loads('{"data": null, "message": "foo", "type": "CLE error"}'), json.loads('{"data": null, "message": "foo", "type": "CLE error"}'),
json.loads(response.data.strip().decode()) json.loads(response.data.strip().decode())
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment