mirror of
https://github.com/cypherstack/stack_wallet.git
synced 2025-01-09 12:19:24 +00:00
instead of checking if it's a List, check if it's not a Map
This commit is contained in:
parent
53931eda32
commit
15a9543c9f
1 changed files with 17 additions and 19 deletions
|
@ -748,27 +748,25 @@ class ElectrumXClient {
|
||||||
return {"rawtx": response["result"] as String};
|
return {"rawtx": response["result"] as String};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (response is List) {
|
if (response is! Map) {
|
||||||
Logging.instance.log(
|
final String msg = "getTransaction($txHash) returned a non-Map response"
|
||||||
"getTransaction($txHash) returned null response",
|
" of type ${response.runtimeType}.";
|
||||||
level: LogLevel.Error,
|
Logging.instance.log(msg, level: LogLevel.Fatal);
|
||||||
);
|
throw Exception(msg);
|
||||||
throw 'getTransaction($txHash) returned null response';
|
|
||||||
} else {
|
|
||||||
if (response["result"] == null) {
|
|
||||||
Logging.instance.log(
|
|
||||||
"getTransaction($txHash) returned null response",
|
|
||||||
level: LogLevel.Error,
|
|
||||||
);
|
|
||||||
throw 'getTransaction($txHash) returned null response';
|
|
||||||
}
|
|
||||||
return Map<String, dynamic>.from(response["result"] as Map);
|
|
||||||
}
|
}
|
||||||
} catch (e) {
|
|
||||||
|
if (response["result"] == null) {
|
||||||
|
final String msg = "getTransaction($txHash) returned null result."
|
||||||
|
"\nResponse: $response";
|
||||||
|
Logging.instance.log(msg, level: LogLevel.Fatal);
|
||||||
|
throw Exception(msg);
|
||||||
|
}
|
||||||
|
return Map<String, dynamic>.from(response["result"] as Map);
|
||||||
|
} catch (e, s) {
|
||||||
Logging.instance.log(
|
Logging.instance.log(
|
||||||
"getTransaction($txHash) response: $response",
|
"getTransaction($txHash) response: $response"
|
||||||
level: LogLevel.Error,
|
"\nError: $e\nStack trace: $s",
|
||||||
);
|
level: LogLevel.Error);
|
||||||
rethrow;
|
rethrow;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue