[−][src]Struct actix_http::error::InternalError
Helper type that can wrap any error and generate custom response.
In following example any io::Error
will be converted into "BAD REQUEST"
response as opposite to INTERNAL SERVER ERROR which is defined by
default.
fn index(req: Request) -> Result<&'static str> { Err(error::ErrorBadRequest(io::Error::new(io::ErrorKind::Other, "error"))) }
Methods
impl<T> InternalError<T>
[src]
pub fn new(cause: T, status: StatusCode) -> Self
[src]
Create InternalError
instance
pub fn from_response(cause: T, response: Response) -> Self
[src]
Create InternalError
with predefined Response
.
Trait Implementations
impl<T> ResponseError for InternalError<T> where
T: Debug + Display + 'static,
[src]
T: Debug + Display + 'static,
fn error_response(&self) -> Response
[src]
fn render_response(&self) -> Response
[src]
Constructs an error response
impl<T> Debug for InternalError<T> where
T: Debug + 'static,
[src]
T: Debug + 'static,
impl<T> Display for InternalError<T> where
T: Display + 'static,
[src]
T: Display + 'static,
Auto Trait Implementations
impl<T> !Send for InternalError<T>
impl<T> !Sync for InternalError<T>
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From for T
[src]
impl<T, U> Into for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.