mirror of
https://github.com/logos-storage/nim-ethers.git
synced 2026-01-06 23:53:10 +00:00
fix(jsonrpc): propagate cancelled error in call
- CancelledError was being swallowed by except CatchableError
This commit is contained in:
parent
0f98528758
commit
1ba4b2c51e
@ -88,10 +88,16 @@ proc new*(
|
||||
proc callImpl(
|
||||
client: RpcClient,
|
||||
call: string,
|
||||
args: JsonNode): Future[JsonNode] {.async: (raises: [JsonRpcProviderError]).} =
|
||||
args: JsonNode): Future[JsonNode] {.async: (raises: [CancelledError, JsonRpcProviderError]).} =
|
||||
|
||||
var response: JsonString
|
||||
try:
|
||||
response = await client.call(call, %args)
|
||||
except CancelledError as e:
|
||||
raise e
|
||||
except CatchableError as e:
|
||||
raiseJsonRpcProviderError e.msg
|
||||
|
||||
without response =? (await client.call(call, %args)).catch, error:
|
||||
raiseJsonRpcProviderError error.msg
|
||||
without json =? JsonNode.fromJson(response.string), error:
|
||||
raiseJsonRpcProviderError "Failed to parse response: " & error.msg
|
||||
json
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user