Struct actix_web::error::InternalError  
source · [−]pub struct InternalError<T> { /* private fields */ }Expand description
Wraps errors to alter the generated response status code.
In following example, the io::Error is wrapped into ErrorBadRequest which will generate a
response with the 400 Bad Request status code instead of the usual status code generated by
an io::Error.
Examples
async fn handler_error() -> Result<String, actix_web::Error> {
    let err = io::Error::new(io::ErrorKind::Other, "error");
    Err(error::ErrorBadRequest(err))
}Implementations
sourceimpl<T> InternalError<T>
 
impl<T> InternalError<T>
sourcepub fn new(cause: T, status: StatusCode) -> Self
 
pub fn new(cause: T, status: StatusCode) -> Self
Constructs an InternalError with given status code.
sourcepub fn from_response(cause: T, response: HttpResponse) -> Self
 
pub fn from_response(cause: T, response: HttpResponse) -> Self
Constructs an InternalError with pre-defined response.
Trait Implementations
sourceimpl<T: Debug> Debug for InternalError<T>
 
impl<T: Debug> Debug for InternalError<T>
sourceimpl<T: Display> Display for InternalError<T>
 
impl<T: Display> Display for InternalError<T>
sourceimpl<T> Responder for InternalError<T> where
    T: Debug + Display + 'static, 
 
impl<T> Responder for InternalError<T> where
    T: Debug + Display + 'static, 
type Body = BoxBody
sourcefn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
 
fn respond_to(self, _: &HttpRequest) -> HttpResponse<Self::Body>ⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
Convert self to HttpResponse.
sourcefn customize(self) -> CustomizeResponder<Self> where
    Self: Sized, 
 
fn customize(self) -> CustomizeResponder<Self> where
    Self: Sized, 
Wraps responder to allow alteration of its response. Read more
sourceimpl<T> ResponseError for InternalError<T> where
    T: Debug + Display, 
 
impl<T> ResponseError for InternalError<T> where
    T: Debug + Display, 
sourcefn status_code(&self) -> StatusCode
 
fn status_code(&self) -> StatusCode
Returns appropriate status code for error. Read more
sourcefn error_response(&self) -> HttpResponseⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
 
fn error_response(&self) -> HttpResponseⓘNotable traits for HttpResponse<BoxBody>impl Future for HttpResponse<BoxBody>    type Output = Result<Response<BoxBody>, Error>;
Creates full response for error. Read more
Auto Trait Implementations
impl<T> !RefUnwindSafe for InternalError<T>
impl<T> !Send for InternalError<T>
impl<T> !Sync for InternalError<T>
impl<T> Unpin for InternalError<T> where
    T: Unpin, 
impl<T> !UnwindSafe for InternalError<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
    T: ?Sized, 
 
impl<T> BorrowMut<T> for T where
    T: ?Sized, 
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
 
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
 
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
 
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
 
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
 
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
 
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
    S: Into<Dispatch>, 
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
 
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more
