[]Struct actix_web::error::InternalError

pub struct InternalError<T> { /* fields omitted */ }

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")))


impl<T> InternalError<T>

pub fn new(cause: T, status: StatusCode) -> InternalError<T>

Create InternalError instance

pub fn from_response(cause: T, response: Response<Body>) -> InternalError<T>

Create InternalError with predefined Response.

Trait Implementations

impl<T> Debug for InternalError<T> where
    T: Debug + 'static, 

impl<T> ResponseError for InternalError<T> where
    T: Debug + Display + 'static, 

fn render_response(&self) -> Response<Body>

Constructs an error response

impl<T> Display for InternalError<T> where
    T: Display + 'static, 

impl<T> Responder for InternalError<T> where
    T: Debug + Display + 'static, 

type Error = Error

The associated error which can be returned.

type Future = Result<Response, Error>

The future response value.

fn with_status(self, status: StatusCode) -> CustomResponder<Self> where
    Self: Sized

Override a status code for a Responder. Read more

fn with_header<K, V>(self, key: K, value: V) -> CustomResponder<Self> where
    Self: Sized,
    HeaderName: HttpTryFrom<K>,
    V: IntoHeaderValue

Add header to the Responder's response. Read more

Auto Trait Implementations

impl<T> Unpin for InternalError<T> where
    T: Unpin

impl<T> !Sync for InternalError<T>

impl<T> !Send for InternalError<T>

impl<T> !UnwindSafe for InternalError<T>

impl<T> !RefUnwindSafe for InternalError<T>

Blanket Implementations

impl<T> From<T> for T[src]

impl<T> ToString for T where
    T: Display + ?Sized

impl<T, U> Into<U> for T where
    U: From<T>, 

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized

impl<T> Borrow<T> for T where
    T: ?Sized

impl<T> Any for T where
    T: 'static + ?Sized

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,