mirror of https://github.com/fafhrd91/actix-web
Implement `ResponseError` for `Infallible`
This commit is contained in:
parent
6a5b370206
commit
7b8f7ae4f3
|
@ -51,12 +51,6 @@ impl StdError for Error {
|
|||
}
|
||||
}
|
||||
|
||||
impl From<std::convert::Infallible> for Error {
|
||||
fn from(val: std::convert::Infallible) -> Self {
|
||||
match val {}
|
||||
}
|
||||
}
|
||||
|
||||
/// `Error` for any error that implements `ResponseError`
|
||||
impl<T: ResponseError + 'static> From<T> for Error {
|
||||
fn from(err: T) -> Error {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
//! `ResponseError` trait and foreign impls.
|
||||
|
||||
use std::{
|
||||
convert::Infallible,
|
||||
error::Error as StdError,
|
||||
fmt,
|
||||
io::{self, Write as _},
|
||||
|
@ -54,6 +55,15 @@ downcast_dyn!(ResponseError);
|
|||
|
||||
impl ResponseError for Box<dyn StdError + 'static> {}
|
||||
|
||||
impl ResponseError for Infallible {
|
||||
fn status_code(&self) -> StatusCode {
|
||||
match *self {}
|
||||
}
|
||||
fn error_response(&self) -> HttpResponse<BoxBody> {
|
||||
match *self {}
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(feature = "openssl")]
|
||||
impl ResponseError for actix_tls::accept::openssl::reexports::Error {}
|
||||
|
||||
|
|
Loading…
Reference in New Issue