mirror of
https://github.com/MercuryWorkshop/epoxy-tls.git
synced 2025-05-13 06:20:02 -04:00
make it fully typed and errors more verbose
This commit is contained in:
parent
e35717bf2c
commit
373d2f4a4d
5 changed files with 79 additions and 47 deletions
|
@ -274,7 +274,7 @@ impl ConnectSvc for StreamProviderService {
|
|||
fn connect(self, req: hyper::Uri) -> Self::Future {
|
||||
let provider = self.0.clone();
|
||||
Box::pin(async move {
|
||||
let scheme = req.scheme_str().ok_or(EpoxyError::InvalidUrlScheme)?;
|
||||
let scheme = req.scheme_str().ok_or(EpoxyError::InvalidUrlScheme(None))?;
|
||||
let host = req.host().ok_or(EpoxyError::NoUrlHost)?.to_string();
|
||||
let port = req.port_u16().map(Ok).unwrap_or_else(|| match scheme {
|
||||
"https" | "wss" => Ok(443),
|
||||
|
@ -287,7 +287,7 @@ impl ConnectSvc for StreamProviderService {
|
|||
"http" | "ws" => {
|
||||
Either::Right(provider.get_asyncread(StreamType::Tcp, host, port).await?)
|
||||
}
|
||||
_ => return Err(EpoxyError::InvalidUrlScheme),
|
||||
_ => return Err(EpoxyError::InvalidUrlScheme(Some(scheme.to_string()))),
|
||||
},
|
||||
})
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue