# actix_web::error::ResponseError - Rust
API documentation for the Rust `ResponseError` trait in crate `actix_web`.
Keywords: rust, rustlang, rust-lang, ResponseError

# [−] [src] Trait actix_web::error::ResponseError

    pub trait ResponseError: Fail + InternalResponseErrorAsFail {
        fn error_response(&self) -> HttpResponse { ... }
    }

Error that can be converted to `HttpResponse`

## Provided Methods

### `fn error_response(&self) -> HttpResponse`

Create response for error

Internal server error is generated by default.

## Implementations on Foreign Types

###

`impl<T> ResponseError for Compat<T> where T: Display + Debug + Sync + Send + 'static,`

[src]

Compatibility for `failure::Error`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for JsonError`

[src]

`InternalServerError` for `JsonError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for FormError`

[src]

`InternalServerError` for `FormError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for TimerError`

[src]

`InternalServerError` for `TimerError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for DeError`

[src]

Return `BAD_REQUEST` for `de::value::Error`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for Utf8Error`

[src]

Return `BAD_REQUEST` for `Utf8Error`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for HttpError`

[src]

Return `InternalServerError` for `HttpError`, Response generation can return `HttpError`, so it is internal error

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for Error`

[src]

Return `InternalServerError` for `io::Error`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for Canceled`

[src]

`InternalServerError` for `futures::Canceled`

####

`fn error_response(&self) -> HttpResponse`

[src]

## Implementors

###

`impl ResponseError for MailboxError`

[src]

`InternalServerError` for `actix::MailboxError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for SendRequestError`

[src]

Convert `SendRequestError` to a `HttpResponse`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for ContentTypeError`

[src]

Return `BadRequest` for `ContentTypeError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for actix_web::error::CookieParseError`

[src]

Return `BadRequest` for `cookie::ParseError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for ExpectError`

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for JsonPayloadError`

[src]

Return `BadRequest` for `UrlencodedError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for MultipartError`

[src]

Return `BadRequest` for `MultipartError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for actix_web::error::ParseError`

[src]

Return `BadRequest` for `ParseError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for PayloadError`

[src]

`PayloadError` returns two possible results:

- `Overflow` returns `PayloadTooLarge`
- Other errors returns `BadRequest`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for StaticFileError`

[src]

Return `NotFound` for `StaticFileError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for UriSegmentError`

[src]

Return `BadRequest` for `UriSegmentError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for UrlGenerationError`

[src]

`InternalServerError` for `UrlGeneratorError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for UrlParseError`

[src]

`InternalServerError` for `UrlParseError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for UrlencodedError`

[src]

Return `BadRequest` for `UrlencodedError`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for CorsError`

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for CsrfError`

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for CookieSessionError`

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for HandshakeError`

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for ProtocolError`

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for InvalidHeaderValue`

[src]

`BadRequest` for `InvalidHeaderValue`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

`impl ResponseError for InvalidHeaderValueBytes`

[src]

`BadRequest` for `InvalidHeaderValue`

####

`fn error_response(&self) -> HttpResponse`

[src]

###

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

[src]

####

`fn error_response(&self) -> HttpResponse`

[src]

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)