[][src]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")))
}

Methods

impl<T> InternalError<T>[src]

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

Create InternalError instance

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

Create InternalError with predefined Response.

Trait Implementations

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

fn render_response(&self) -> Response<Body>[src]

Constructs an error response

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

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

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

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
[src]

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
[src]

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> !RefUnwindSafe for InternalError<T>

impl<T> !UnwindSafe for InternalError<T>

Blanket Implementations

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

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

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

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

impl<T> Erased for T

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