1
0
mirror of https://github.com/fafhrd91/actix-web synced 2025-07-01 16:55:08 +02:00

fix master branch build. change web::block output type. (#1957)

This commit is contained in:
fakeshadow
2021-02-06 08:23:59 -08:00
committed by GitHub
parent 83fb4978ad
commit 20cf0094e5
17 changed files with 98 additions and 114 deletions

View File

@ -297,17 +297,13 @@ impl From<httparse::Error> for ParseError {
/// A set of errors that can occur running blocking tasks in thread pool.
#[derive(Debug, Display)]
pub enum BlockingError<E: fmt::Debug> {
#[display(fmt = "{:?}", _0)]
Error(E),
#[display(fmt = "Thread pool is gone")]
Canceled,
}
#[display(fmt = "Blocking thread pool is gone")]
pub struct BlockingError;
impl<E: fmt::Debug> std::error::Error for BlockingError<E> {}
impl std::error::Error for BlockingError {}
/// `InternalServerError` for `BlockingError`
impl<E: fmt::Debug> ResponseError for BlockingError<E> {}
impl ResponseError for BlockingError {}
#[derive(Display, Debug)]
/// A set of errors that can occur during payload parsing
@ -372,15 +368,12 @@ impl From<io::Error> for PayloadError {
}
}
impl From<BlockingError<io::Error>> for PayloadError {
fn from(err: BlockingError<io::Error>) -> Self {
match err {
BlockingError::Error(e) => PayloadError::Io(e),
BlockingError::Canceled => PayloadError::Io(io::Error::new(
io::ErrorKind::Other,
"Operation is canceled",
)),
}
impl From<BlockingError> for PayloadError {
fn from(_: BlockingError) -> Self {
PayloadError::Io(io::Error::new(
io::ErrorKind::Other,
"Operation is canceled",
))
}
}