pub struct ReceiveError { /* private fields */ }Expand description
An error returned by Shard::next_event.
Most errors are not fatal: the shard has already scheduled a reconnect (or skipped the
offending payload) and the next call to next_event continues normally. Only
is_fatal errors end the shard; after one, next_event returns None.
discord.js counterpart: the error event of WebSocketShard (@discordjs/ws).
Implementations§
Source§impl ReceiveError
impl ReceiveError
Sourcepub const fn kind(&self) -> &ReceiveErrorKind
pub const fn kind(&self) -> &ReceiveErrorKind
Returns what went wrong.
discord.js counterpart: the error event of WebSocketShard (@discordjs/ws).
Sourcepub const fn is_fatal(&self) -> bool
pub const fn is_fatal(&self) -> bool
Returns true if the shard cannot continue (for example because the token is invalid
or a privileged intent is not enabled). No further events will be produced.
discord.js counterpart: none (@discordjs/ws throws on fatal close codes).
Sourcepub fn into_parts(
self,
) -> (ReceiveErrorKind, Option<Box<dyn Error + Send + Sync>>)
pub fn into_parts( self, ) -> (ReceiveErrorKind, Option<Box<dyn Error + Send + Sync>>)
Consumes the error, returning its kind and underlying source.
discord.js counterpart: none (JavaScript errors are not taken apart).
Trait Implementations§
Source§impl Debug for ReceiveError
impl Debug for ReceiveError
Source§impl Display for ReceiveError
impl Display for ReceiveError
Source§impl Error for ReceiveError
impl Error for ReceiveError
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 !RefUnwindSafe for ReceiveError
impl !UnwindSafe for ReceiveError
impl Freeze for ReceiveError
impl Send for ReceiveError
impl Sync for ReceiveError
impl Unpin for ReceiveError
impl UnsafeUnpin for ReceiveError
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