From 66952789579baf4a9345edf747e56f8aa3b83397 Mon Sep 17 00:00:00 2001 From: julian Date: Fri, 20 Oct 2023 12:28:53 -0600 Subject: [PATCH] print error --- lib/electrumx_rpc/electrumx.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/electrumx_rpc/electrumx.dart b/lib/electrumx_rpc/electrumx.dart index 88c49cc45..eea9bed0b 100644 --- a/lib/electrumx_rpc/electrumx.dart +++ b/lib/electrumx_rpc/electrumx.dart @@ -387,7 +387,14 @@ class ElectrumX { throw jsonRpcResponse.exception!; } - final response = jsonRpcResponse.data as List; + final List response; + try { + response = jsonRpcResponse.data as List; + } catch (_) { + throw Exception( + "Expected json list but got a map: ${jsonRpcResponse.data}", + ); + } // check for errors, format and throw if there are any final List errors = [];