From e53afb33139c84afeec6f9cac010a469a894b6aa Mon Sep 17 00:00:00 2001 From: Natty Date: Sat, 16 Nov 2024 00:11:18 +0100 Subject: [PATCH] Print RPC errors in Debug instead of Display --- src/rpc_v1/proto.rs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/rpc_v1/proto.rs b/src/rpc_v1/proto.rs index d3388a0..aa708eb 100644 --- a/src/rpc_v1/proto.rs +++ b/src/rpc_v1/proto.rs @@ -1,22 +1,21 @@ use crate::service::MagnetarService; -use bytes::BufMut; use futures::{FutureExt, Stream, StreamExt}; use miette::{miette, IntoDiagnostic}; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use std::any::Any; use std::collections::HashMap; -use std::fmt::Display; +use std::fmt::Debug; use std::future::Future; use std::net::SocketAddr; use std::path::{Path, PathBuf}; use std::pin::Pin; use std::sync::Arc; -use tokio::io::{AsyncRead, AsyncReadExt, AsyncWriteExt, BufReader, ReadBuf}; +use tokio::io::{AsyncRead, AsyncReadExt, AsyncWriteExt, BufReader}; use tokio::net::{TcpListener, UnixSocket}; use tokio::select; use tokio::task::JoinSet; -use tracing::{debug, error, info, Instrument}; +use tracing::{debug, error, info, warn, Instrument}; #[derive(Debug, Clone)] pub enum RpcSockAddr { @@ -56,7 +55,7 @@ pub struct RpcResult { data: T, } -impl IntoRpcResponse +impl IntoRpcResponse for Result { fn into_rpc_response(self) -> Option { @@ -67,7 +66,7 @@ impl Int }) .into_rpc_response(), Err(data) => { - error!("{}", data); + warn!("{:?}", data); RpcMessage(RpcResult { success: false, data,