Struct actix_web::error::InternalError [−][src]
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.
use actix_web::fs::NamedFile; fn index(req: HttpRequest) -> Result<fs::NamedFile> { let f = NamedFile::open("test.txt").map_err(error::ErrorBadRequest)?; Ok(f) }
Methods
impl<T> InternalError<T>
[src]
[−]
impl<T> InternalError<T>
pub fn new(cause: T, status: StatusCode) -> Self
[src]
[−]
pub fn new(cause: T, status: StatusCode) -> Self
Create InternalError
instance
pub fn from_response(cause: T, response: HttpResponse) -> Self
[src]
[−]
pub fn from_response(cause: T, response: HttpResponse) -> Self
Create InternalError
with predefined HttpResponse
.
Trait Implementations
impl<T> Fail for InternalError<T> where
T: Send + Sync + Debug + Display + 'static,
[src]
[+]
impl<T> Fail for InternalError<T> where
T: Send + Sync + Debug + Display + 'static,
impl<T> Debug for InternalError<T> where
T: Send + Sync + Debug + 'static,
[src]
[+]
impl<T> Debug for InternalError<T> where
T: Send + Sync + Debug + 'static,
impl<T> Display for InternalError<T> where
T: Send + Sync + Display + 'static,
[src]
[+]
impl<T> Display for InternalError<T> where
T: Send + Sync + Display + 'static,
impl<T> ResponseError for InternalError<T> where
T: Send + Sync + Debug + Display + 'static,
[src]
[+]
impl<T> ResponseError for InternalError<T> where
T: Send + Sync + Debug + Display + 'static,
impl<T> Responder for InternalError<T> where
T: Send + Sync + Debug + Display + 'static,
[src]
[+]
impl<T> Responder for InternalError<T> where
T: Send + Sync + Debug + Display + 'static,
Auto Trait Implementations
impl<T> Send for InternalError<T> where
T: Send,
impl<T> Send for InternalError<T> where
T: Send,
impl<T> Sync for InternalError<T> where
T: Sync,
impl<T> Sync for InternalError<T> where
T: Sync,