pub enum HTTPError {
Show 25 variants
BadRequest,
Unauthorized,
Forbidden,
NotFound,
MethodNotAllowed(Option<Vec<Method>>),
NotAcceptable,
RequestTimeout,
Conflict,
Gone,
LengthRequired,
PreconditionFailed,
RequestEntityTooLarge,
RequestURITooLarge,
UnsupportedMediaType,
RequestedRangeNotSatisfiable,
ExpectationFailed,
ImATeapot,
UnprocessableEntity,
PreconditionRequired,
TooManyRequests,
RequestHeaderFieldsTooLarge,
InternalServerError,
NotImplemented,
BadGateway,
ServiceUnavailable,
}Expand description
The HTTP Error type you can return from within your views to trigger a non-200 response. Here is one usage example:
use chilli::{Request, PencilResult, PenHTTPError};
use chilli::http_errors::NotFound;
fn view(_: &mut Request) -> PencilResult {
return Err(PenHTTPError(NotFound))
}Pencil comes with a shortcut that can be used to return non-200 HTTP error easily:
use chilli::{Request, PencilResult};
use chilli::abort;
fn view(_: &mut Request) -> PencilResult {
return abort(404)
}Variants§
BadRequest
Forbidden
NotFound
MethodNotAllowed(Option<Vec<Method>>)
NotAcceptable
RequestTimeout
Conflict
Gone
LengthRequired
PreconditionFailed
RequestEntityTooLarge
RequestURITooLarge
UnsupportedMediaType
RequestedRangeNotSatisfiable
ExpectationFailed
ImATeapot
UnprocessableEntity
PreconditionRequired
TooManyRequests
RequestHeaderFieldsTooLarge
InternalServerError
NotImplemented
BadGateway
Implementations§
Trait Implementations§
Source§impl Error for HTTPError
impl Error for HTTPError
Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
Source§impl From<HTTPError> for PencilError
impl From<HTTPError> for PencilError
Source§fn from(err: HTTPError) -> PencilError
fn from(err: HTTPError) -> PencilError
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for HTTPError
impl RefUnwindSafe for HTTPError
impl Send for HTTPError
impl Sync for HTTPError
impl Unpin for HTTPError
impl UnwindSafe for HTTPError
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more