From 345b17b21f26194755de8a8fc0e7fedb58ad3aee Mon Sep 17 00:00:00 2001 From: miruka Date: Tue, 23 Jul 2019 14:48:37 -0400 Subject: [PATCH] Catch ErrorResponse json.dumps error --- src/python/matrix_client.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/python/matrix_client.py b/src/python/matrix_client.py index 56813795..178c53db 100644 --- a/src/python/matrix_client.py +++ b/src/python/matrix_client.py @@ -301,7 +301,10 @@ class MatrixClient(nio.AsyncClient): async def onErrorResponse(self, resp: nio.ErrorResponse) -> None: # TODO: show something in the client - log.warning("%s - %s", resp, json.dumps(resp.__dict__, indent=4)) + try: + log.warning("%s - %s", resp, json.dumps(resp.__dict__, indent=4)) + except Exception: + log.warning(repr(resp)) # Callbacks for nio events