Enum rocket_cors::Error

source ·
pub enum Error {
    MissingOrigin,
    BadOrigin(ParseError),
    MissingRequestMethod,
    BadRequestMethod,
    MissingRequestHeaders,
    OriginNotAllowed,
    MethodNotAllowed,
    HeadersNotAllowed,
    CredentialsWithWildcardOrigin,
    MissingCorsInRocketState,
    MissingInjectedHeader,
}
Expand description

Errors during operations

This enum implements rocket::response::Responder which will return an appropriate status code while printing out the error in the console. Because these errors are usually the result of an error while trying to respond to a CORS request, CORS headers cannot be added to the response and your applications requesting CORS will not be able to see the status code.

Variants

MissingOrigin

The HTTP request header Origin is required but was not provided

BadOrigin(ParseError)

The HTTP request header Origin could not be parsed correctly.

MissingRequestMethod

The request header Access-Control-Request-Method is required but is missing

BadRequestMethod

The request header Access-Control-Request-Method has an invalid value

MissingRequestHeaders

The request header Access-Control-Request-Headers is required but is missing.

OriginNotAllowed

Origin is not allowed to make this request

MethodNotAllowed

Requested method is not allowed

HeadersNotAllowed

One or more headers requested are not allowed

CredentialsWithWildcardOrigin

Credentials are allowed, but the Origin is set to “*”. This is not allowed by W3C

This is a misconfiguration. Check the docuemntation for Cors.

MissingCorsInRocketState

A CORS Request Guard was used, but no CORS Options was available in Rocket’s state

This is a misconfiguration. Use Rocket::manage to add a CORS options to managed state.

MissingInjectedHeader

The on_response handler of Fairing could not find the injected header from the Request. Either some other fairing has removed it, or this is a bug.

Trait Implementations

Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
👎Deprecated since 1.42.0: use the Display impl or to_string()
👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
The lower-level source of this error, if any. Read more
🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type based access to context intended for error reports. Read more
Returns Ok if a Response could be generated successfully. Otherwise, returns an Err with a failing Status. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts self into a collection.
🔬This is a nightly-only experimental API. (provide_any)
Data providers should implement this method to provide all values they are able to provide by using demand. Read more
Should always be Self
Converts the given value to a String. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Get the TypeId of this object.