[−][src]Struct actix_web::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) -> 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> 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,
impl<T> ResponseError for InternalError<T> where
T: Debug + Display + 'static,
[src]
T: Debug + Display + 'static,
fn error_response(&self) -> Response<Body>
[src]
fn render_response(&self) -> Response<Body>
[src]
Constructs an error response
impl<T> Responder for InternalError<T> where
T: Debug + Display + 'static,
[src]
T: Debug + Display + 'static,
type Error = Error
The associated error which can be returned.
type Future = Result<Response, Error>
The future response value.
fn respond_to(self, _: &HttpRequest) -> Self::Future
[src]
fn with_status(self, status: StatusCode) -> CustomResponder<Self> where
Self: Sized,
[src]
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,
[src]
Self: Sized,
HeaderName: HttpTryFrom<K>,
V: IntoHeaderValue,
Add header to the Responder's response. Read more
Auto Trait Implementations
impl<T> !Send for InternalError<T>
impl<T> Unpin for InternalError<T> where
T: Unpin,
T: Unpin,
impl<T> !Sync for InternalError<T>
impl<T> !UnwindSafe for InternalError<T>
impl<T> !RefUnwindSafe for InternalError<T>
Blanket Implementations
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> 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, U> TryInto<U> 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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,