From f81c69e73361daafac4d6c7749decc2e9ed3ce97 Mon Sep 17 00:00:00 2001 From: One <43485962+c-git@users.noreply.github.com> Date: Sun, 5 Jan 2025 04:37:11 -0500 Subject: [PATCH] feat: add debug bound on error types I don't know any error types that are not debug and if we run into any we'll have to wrap them because not being able to use the debug representation in the traces is just not worth it. --- src/data_state.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/data_state.rs b/src/data_state.rs index aadfa29..feb8cba 100644 --- a/src/data_state.rs +++ b/src/data_state.rs @@ -8,8 +8,8 @@ use thiserror::Error; use tracing::{error, warn}; /// Provides a common way to specify the bounds errors are expected to meet -pub trait ErrorBounds: Display + Send + Sync + 'static {} -impl ErrorBounds for T {} +pub trait ErrorBounds: Display + Send + Sync + 'static + Debug {} +impl ErrorBounds for T {} #[derive(Error, Debug)] /// Represents the types of errors that can occur while using [DataState] @@ -146,12 +146,9 @@ impl DataState { Ok(recv_opt) => match recv_opt { Some(outcome_result) => match outcome_result { Ok(data) => DataState::Present(data), - Err(e) => { - warn!( - err_msg = e.to_string(), - "Error response received instead of the data" - ); - DataState::Failed(DataStateError::ErrorResponse(e)) + Err(err_msg) => { + warn!(?err_msg, "Error response received instead of the data"); + DataState::Failed(DataStateError::ErrorResponse(err_msg)) } }, None => {