Client pass meaningful error to newFut when processMessage failed

This commit is contained in:
jangko 2024-01-23 12:10:33 +07:00
parent 26a6cb1790
commit dad0255c71
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
2 changed files with 4 additions and 3 deletions

View File

@ -152,10 +152,11 @@ method call*(client: RpcHttpClient, name: string,
if msgRes.isErr:
# Need to clean up in case the answer was invalid
debug "Failed to process POST Response for JSON-RPC", msg = msgRes.error
newFut.cancelSoon()
let exc = newException(JsonRpcError, msgRes.error)
newFut.fail(exc)
client.awaiting.del(id)
closeRefs()
raise newException(JsonRpcError, msgRes.error)
raise exc
client.awaiting.del(id)

View File

@ -86,7 +86,7 @@ proc handleRequest(rpc: RpcWebSocketServer, request: HttpRequest) {.async: (rais
debug "Internal error, while processing RPC call",
address = $request.uri
await ws.close(
reason = "Internal error, while processing RPC call"
reason = "Internal error, while processing RPC call: " & exc.msg
)
break