From ad3b0e1ffb13a21052c588c50a85d374d664d121 Mon Sep 17 00:00:00 2001 From: Natty Date: Fri, 15 Nov 2024 23:43:01 +0100 Subject: [PATCH] Report RPC errors --- src/rpc_v1/proto.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/rpc_v1/proto.rs b/src/rpc_v1/proto.rs index d1fc053..d3388a0 100644 --- a/src/rpc_v1/proto.rs +++ b/src/rpc_v1/proto.rs @@ -6,6 +6,7 @@ use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::any::Any; use std::collections::HashMap; +use std::fmt::Display; use std::future::Future; use std::net::SocketAddr; use std::path::{Path, PathBuf}; @@ -55,7 +56,7 @@ pub struct RpcResult { data: T, } -impl IntoRpcResponse +impl IntoRpcResponse for Result { fn into_rpc_response(self) -> Option { @@ -65,11 +66,14 @@ impl IntoRpcRespon data, }) .into_rpc_response(), - Err(data) => RpcMessage(RpcResult { - success: false, - data, - }) - .into_rpc_response(), + Err(data) => { + error!("{}", data); + RpcMessage(RpcResult { + success: false, + data, + }) + .into_rpc_response() + } } } }