Enum chilli::http_errors::HTTPError [] [src]

pub enum HTTPError {
    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,
}

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

Methods

impl HTTPError
[src]

[src]

Create a new HTTPError.

[src]

The status code.

[src]

The status name.

[src]

Get the HTML body.

[src]

Get a response object.

Trait Implementations

impl Clone for HTTPError
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for HTTPError
[src]

[src]

Formats the value using the given formatter. Read more

impl Display for HTTPError
[src]

[src]

Formats the value using the given formatter. Read more

impl Error for HTTPError
[src]

[src]

A short description of the error. Read more

1.0.0
[src]

The lower-level cause of this error, if any. Read more

impl From<HTTPError> for PencilError
[src]

[src]

Performs the conversion.

Auto Trait Implementations

impl Send for HTTPError

impl Sync for HTTPError