Skip to content

Commit 9fa8cff

Browse files
shaansubbaiahquozl
authored andcommitted
Fix TypeError: Object of type DBusException is not JSON serializable
When a datastore exception occurs, the error cannot be sent to the caller because the object cannot be serialised. Problem was inherent in original design. Convert the exception to a string before sending it. Related to #909 Part of #911 Signed-off-by: James Cameron <[email protected]>
1 parent b9ea02c commit 9fa8cff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/jarabe/apisocket.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -261,6 +261,9 @@ def send_result(self, request, result):
261261
self._session.send_message(json.dumps(response))
262262

263263
def send_error(self, request, error):
264+
if isinstance(error, dbus.exceptions.DBusException):
265+
error = error.get_dbus_name() + " " + error.get_dbus_message()
266+
264267
response = {"result": None,
265268
"error": error,
266269
"id": request["id"]}

0 commit comments

Comments
 (0)