[dep-upgrade-202402] slightly more explicit error management
This commit is contained in:
parent
a31d1bd496
commit
53746b59e5
2 changed files with 7 additions and 3 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
use std::convert::Infallible;
|
||||||
use std::fs::{self, Permissions};
|
use std::fs::{self, Permissions};
|
||||||
use std::os::unix::fs::PermissionsExt;
|
use std::os::unix::fs::PermissionsExt;
|
||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
@ -194,7 +195,8 @@ impl<A: ApiHandler> ApiServer<A> {
|
||||||
} else {
|
} else {
|
||||||
info!("Response: error {}, {}", e.http_status_code(), e);
|
info!("Response: error {}, {}", e.http_status_code(), e);
|
||||||
}
|
}
|
||||||
Ok(http_error.map(|body| BoxBody::new(body.map_err(|_| unreachable!()))))
|
Ok(http_error
|
||||||
|
.map(|body| BoxBody::new(body.map_err(|_: Infallible| unreachable!()))))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
use std::convert::Infallible;
|
||||||
|
|
||||||
use http_body_util::{BodyExt, Full as FullBody};
|
use http_body_util::{BodyExt, Full as FullBody};
|
||||||
use hyper::{body::Body, Request, Response};
|
use hyper::{body::Body, Request, Response};
|
||||||
use idna::domain_to_unicode;
|
use idna::domain_to_unicode;
|
||||||
|
@ -151,10 +153,10 @@ pub fn string_body<E>(s: String) -> BoxBody<E> {
|
||||||
bytes_body(bytes::Bytes::from(s.into_bytes()))
|
bytes_body(bytes::Bytes::from(s.into_bytes()))
|
||||||
}
|
}
|
||||||
pub fn bytes_body<E>(b: bytes::Bytes) -> BoxBody<E> {
|
pub fn bytes_body<E>(b: bytes::Bytes) -> BoxBody<E> {
|
||||||
BoxBody::new(FullBody::new(b).map_err(|_| unreachable!()))
|
BoxBody::new(FullBody::new(b).map_err(|_: Infallible| unreachable!()))
|
||||||
}
|
}
|
||||||
pub fn empty_body<E>() -> BoxBody<E> {
|
pub fn empty_body<E>() -> BoxBody<E> {
|
||||||
BoxBody::new(http_body_util::Empty::new().map_err(|_| unreachable!()))
|
BoxBody::new(http_body_util::Empty::new().map_err(|_: Infallible| unreachable!()))
|
||||||
}
|
}
|
||||||
pub fn error_body(s: String) -> ErrorBody {
|
pub fn error_body(s: String) -> ErrorBody {
|
||||||
ErrorBody::from(bytes::Bytes::from(s.into_bytes()))
|
ErrorBody::from(bytes::Bytes::from(s.into_bytes()))
|
||||||
|
|
Loading…
Reference in a new issue