Skip to content

Commit

Permalink
Qualify errors from db.rs as db::Error rather than importing
Browse files Browse the repository at this point in the history
This makes more sense since it's not the top-level error in
the modules that were importing it
  • Loading branch information
shinghim committed Jan 16, 2025
1 parent 1d00fed commit d1c9f5b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions payjoin-directory/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use tokio::net::TcpListener;
use tokio::sync::Mutex;
use tracing::{debug, error, info, trace};

use crate::db::{DbPool, Error};
use crate::db::DbPool;

pub const DEFAULT_DIR_PORT: u16 = 8080;
pub const DEFAULT_DB_HOST: &str = "localhost:6379";
Expand Down Expand Up @@ -314,17 +314,17 @@ impl From<hyper::http::Error> for HandlerError {
}

fn handle_peek(
result: Result<Vec<u8>, Error>,
result: Result<Vec<u8>, db::Error>,
timeout_response: Response<BoxBody<Bytes, hyper::Error>>,
) -> Result<Response<BoxBody<Bytes, hyper::Error>>, HandlerError> {
match result {
Ok(buffered_req) => Ok(Response::new(full(buffered_req))),
Err(e) => match e {
Error::Redis(re) => {
db::Error::Redis(re) => {
error!("Redis error: {}", re);
Err(HandlerError::InternalServerError(anyhow::Error::msg("Internal server error")))
}
Error::Timeout(_) => Ok(timeout_response),
db::Error::Timeout(_) => Ok(timeout_response),
},
}
}
Expand Down

0 comments on commit d1c9f5b

Please sign in to comment.