From 94c6fa149e5587aaae2c67b97c32a1d00964925d Mon Sep 17 00:00:00 2001 From: Geoff Taylor Date: Mon, 9 Aug 2021 21:07:21 +0100 Subject: [PATCH] Sometimes Solana returns 'err' as a string instead of an array of strings. --- mango/client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/mango/client.py b/mango/client.py index 3b80f45..3a5a19c 100644 --- a/mango/client.py +++ b/mango/client.py @@ -281,7 +281,9 @@ class CompatibleClient: error_code: int = response["error"]["code"] if "code" in response["error"] else -1 error_data: typing.Dict = response["error"]["data"] if "data" in response["error"] else {} error_accounts = error_data["accounts"] if "accounts" in error_data else "No accounts" - error_err = error_data["err"] if "err" in error_data else "No err" + error_err = error_data["err"] if "err" in error_data else "No error text returned" + if isinstance(error_err, str): + error_err = [error_err] error_logs = error_data["logs"] if "logs" in error_data else "No logs" raise TransactionException(exception_message, error_code, self.name, error_accounts, error_err, error_logs)