mirror of
https://github.com/fafhrd91/actix-web
synced 2025-08-29 08:09:18 +02:00
refined error model (#2253)
This commit is contained in:
@@ -72,7 +72,7 @@ mod inner {
|
||||
|
||||
use actix_codec::{AsyncRead, AsyncWrite, Decoder, Encoder, Framed};
|
||||
|
||||
use crate::ResponseError;
|
||||
use crate::{body::AnyBody, Response};
|
||||
|
||||
/// Framed transport errors
|
||||
pub enum DispatcherError<E, U, I>
|
||||
@@ -136,13 +136,16 @@ mod inner {
|
||||
}
|
||||
}
|
||||
|
||||
impl<E, U, I> ResponseError for DispatcherError<E, U, I>
|
||||
impl<E, U, I> From<DispatcherError<E, U, I>> for Response<AnyBody>
|
||||
where
|
||||
E: fmt::Debug + fmt::Display,
|
||||
U: Encoder<I> + Decoder,
|
||||
<U as Encoder<I>>::Error: fmt::Debug,
|
||||
<U as Decoder>::Error: fmt::Debug,
|
||||
{
|
||||
fn from(err: DispatcherError<E, U, I>) -> Self {
|
||||
Response::internal_server_error().set_body(AnyBody::from(err.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
/// Message type wrapper for signalling end of message stream.
|
||||
|
Reference in New Issue
Block a user