Skip to content

Commit

Permalink
map_err -> or_err
Browse files Browse the repository at this point in the history
  • Loading branch information
cospectrum committed Apr 26, 2024
1 parent 28613b6 commit 629612b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pingora-core/src/upstreams/peer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
//! Defines where to connect to and how to connect to a remote server

use ahash::AHasher;
use pingora_error::{BError, Error, ErrorType};
use pingora_error::{ErrorType, OrErr, Result};
use std::collections::BTreeMap;
use std::fmt::{Display, Formatter, Result as FmtResult};
use std::hash::{Hash, Hasher};
Expand Down Expand Up @@ -408,11 +408,11 @@ impl HttpPeer {
}

/// Create a new [`HttpPeer`] with the given path to Unix domain socket and TLS settings.
pub fn new_uds(path: &str, tls: bool, sni: String) -> Result<Self, BError> {
let addr =
SocketAddr::Unix(UnixSocketAddr::from_pathname(Path::new(path)).map_err(|e| {
Error::because(ErrorType::Custom("invalid path"), "HttpPeer::new_uds", e)
})?);
pub fn new_uds(path: &str, tls: bool, sni: String) -> Result<Self> {
let addr = SocketAddr::Unix(
UnixSocketAddr::from_pathname(Path::new(path))
.or_err(ErrorType::InternalError, "invalid path")?,
);
Ok(Self::new_from_sockaddr(addr, tls, sni))
}

Expand Down

0 comments on commit 629612b

Please sign in to comment.