Skip to content

Commit

Permalink
feat: add debug bound on error types
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
c-git committed Jan 5, 2025
1 parent 1ed0a0d commit f81c69e
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions src/data_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<T: Display + Send + Sync + 'static> ErrorBounds for T {}
pub trait ErrorBounds: Display + Send + Sync + 'static + Debug {}
impl<T: Display + Send + Sync + 'static + Debug> ErrorBounds for T {}

#[derive(Error, Debug)]
/// Represents the types of errors that can occur while using [DataState]
Expand Down Expand Up @@ -146,12 +146,9 @@ impl<T, E: ErrorBounds> DataState<T, E> {
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 => {
Expand Down

0 comments on commit f81c69e

Please sign in to comment.