#[non_exhaustive]pub enum ErrorKind {
BuildRequest,
Transport,
Timeout,
Response {
status: StatusCode,
error: Option<Box<ApiError>>,
},
Deserialize,
NotYetIndexed {
retry_after: Duration,
documents_indexed: u64,
},
InvalidRequestLimit {
count: u32,
limit: u32,
},
}Expand description
The kind of an Error.
discord.js counterpart: DiscordAPIError, HTTPError and RateLimitError (@discordjs/rest).
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
BuildRequest
The request could not be built — for example the token contains characters that are not allowed in an HTTP header, or the body could not be serialized.
Transport
The request could not be sent or the response could not be received (DNS, TCP, TLS, HTTP protocol errors). Retried automatically up to the configured number of times.
Timeout
No complete response arrived within the configured timeout. Retried automatically up to the configured number of times.
Response
Discord responded with a non-success status code.
Fields
status: StatusCodeThe HTTP status code.
Deserialize
The response body could not be deserialized into the expected type.
NotYetIndexed
Search Guild Messages found the guild not indexed
yet (Discord answered 202 Accepted, D-104). Retry after retry_after; Discord sends
zero when it wants “a short delay”.
Fields
InvalidRequestLimit
The request was not sent because the client already made as many invalid requests (401,
403, 429) in the last 10 minutes as the configured
invalid_request_limit allows (D-085).
Discord temporarily bans the IP at 10 000.
Trait Implementations§
Source§impl Error for ErrorKind
impl Error for ErrorKind
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Auto Trait Implementations§
impl Freeze for ErrorKind
impl RefUnwindSafe for ErrorKind
impl Send for ErrorKind
impl Sync for ErrorKind
impl Unpin for ErrorKind
impl UnsafeUnpin for ErrorKind
impl UnwindSafe for ErrorKind
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string()] Read more§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString]. Read more