diff --git a/src/daemon.rs b/src/daemon.rs index 68089079..3aa1f0f3 100644 --- a/src/daemon.rs +++ b/src/daemon.rs @@ -88,10 +88,13 @@ fn parse_jsonrpc_reply(mut reply: Value, method: &str, expected_id: u64) -> Resu if let Some(err) = reply_obj.get_mut("error") { if !err.is_null() { if let Some(code) = parse_error_code(&err) { + let msg = err["message"] + .as_str() + .map_or_else(|| err.to_string(), |s| s.to_string()); match code { // RPC_IN_WARMUP -> retry by later reconnection -28 => bail!(ErrorKind::Connection(err.to_string())), - code => bail!(ErrorKind::RpcError(code, err.take(), method.to_string())), + code => bail!(ErrorKind::RpcError(code, msg, method.to_string())), } } } diff --git a/src/errors.rs b/src/errors.rs index c708d7dd..2c33f9fa 100644 --- a/src/errors.rs +++ b/src/errors.rs @@ -9,7 +9,7 @@ error_chain! { display("Connection error: {}", msg) } - RpcError(code: i64, error: serde_json::Value, method: String) { + RpcError(code: i64, error: String, method: String) { description("RPC error") display("{} RPC error {}: {}", method, code, error) }