#[non_exhaustive]pub enum HttpError {
UnsuccessfulRequest(ErrorResponse),
RateLimitI64F64,
RateLimitUtf8,
Url(ParseError),
InvalidWebhook,
InvalidHeader(InvalidHeaderValue),
Request(Error),
InvalidScheme,
InvalidPort,
ApplicationIdMissing,
}
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
UnsuccessfulRequest(ErrorResponse)
When a non-successful status code was received for a request.
RateLimitI64F64
When the decoding of a ratelimit header could not be properly decoded into an i64
or
f64
.
RateLimitUtf8
When the decoding of a ratelimit header could not be properly decoded from UTF-8.
Url(ParseError)
When parsing an URL failed due to invalid input.
InvalidWebhook
When parsing a Webhook fails due to invalid input.
InvalidHeader(InvalidHeaderValue)
Header value contains invalid input.
Request(Error)
Reqwest’s Error contain information on why sending a request failed.
InvalidScheme
When using a proxy with an invalid scheme.
InvalidPort
When using a proxy with an invalid port.
ApplicationIdMissing
When an application id was expected but missing.
Implementations§
Source§impl HttpError
impl HttpError
Sourcepub fn is_unsuccessful_request(&self) -> bool
pub fn is_unsuccessful_request(&self) -> bool
Returns true when the error is caused by an unsuccessful request
Sourcepub fn is_url_error(&self) -> bool
pub fn is_url_error(&self) -> bool
Returns true when the error is caused by the url containing invalid input
Sourcepub fn is_invalid_header(&self) -> bool
pub fn is_invalid_header(&self) -> bool
Returns true when the error is caused by an invalid header
Sourcepub fn status_code(&self) -> Option<StatusCode>
pub fn status_code(&self) -> Option<StatusCode>
Returns the status code if the error is an unsuccessful request