rust-esplora-client icon indicating copy to clipboard operation
rust-esplora-client copied to clipboard

RPC error message is being swallowed

Open luckysori opened this issue 1 year ago • 10 comments

When calling something like AsyncClient::broadcast, if we get an RPC error back from the electrum server, we immediately convert the response into a generic one based on the status. This means that we lose the context of the error message, which makes debugging harder as one has to check the logs of the electrum server to figure out exactly what went wrong.

For instance, electrum might report

WARN - HttpError(400, "sendrawtransaction RPC error: {\"code\":-26,\"message\":\"non-mandatory-script-verify-flag (Signature must be zero for failed CHECK(MULTI)SIG operation)\"}")

whilst the client gives us

Esplora client error: Reqwest(reqwest::Error { kind: Status(400), url: Url { scheme: "http", cannot_be_a_base: false, username: "", password: None, host: Some(Domain("localhost")), port: Some(3000), path: "/tx", query: None, fragment: None } })

which is much less useful.

luckysori avatar May 05 '23 18:05 luckysori