pub enum RelayError {
Api {
code: String,
message: String,
status: u16,
},
Http(Error),
Json(Error),
Url(ParseError),
WebSocket(Box<Error>),
InvalidResponse(String),
NotConnected,
}Expand description
Errors that can occur when using the RelayCast SDK.
Variants§
Api
An error returned by the RelayCast API.
Fields
Http(Error)
An HTTP request error.
Json(Error)
A JSON serialization/deserialization error.
Url(ParseError)
A URL parsing error.
WebSocket(Box<Error>)
A WebSocket error.
InvalidResponse(String)
The response was invalid or malformed.
NotConnected
The WebSocket is not connected.
Implementations§
Source§impl RelayError
impl RelayError
Sourcepub fn api(
code: impl Into<String>,
message: impl Into<String>,
status: u16,
) -> Self
pub fn api( code: impl Into<String>, message: impl Into<String>, status: u16, ) -> Self
Create a new API error.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Check if this is a retryable error.
Sourcepub fn is_rate_limited(&self) -> bool
pub fn is_rate_limited(&self) -> bool
Check if this is a rate-limit error (HTTP 429).
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Check if this is a not-found error (HTTP 404).
Sourcepub fn is_auth_rejection(&self) -> bool
pub fn is_auth_rejection(&self) -> bool
Check if this is an authentication/authorization rejection (HTTP 401 or 403).
Sourcepub fn is_conflict(&self) -> bool
pub fn is_conflict(&self) -> bool
Check if this is a conflict error (HTTP 409).
Trait Implementations§
Source§impl Debug for RelayError
impl Debug for RelayError
Source§impl Display for RelayError
impl Display for RelayError
Source§impl Error for RelayError
impl Error for RelayError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Source§impl From<Error> for RelayError
impl From<Error> for RelayError
Source§impl From<Error> for RelayError
impl From<Error> for RelayError
Source§impl From<Error> for RelayError
impl From<Error> for RelayError
Source§impl From<ParseError> for RelayError
impl From<ParseError> for RelayError
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for RelayError
impl !RefUnwindSafe for RelayError
impl Send for RelayError
impl Sync for RelayError
impl Unpin for RelayError
impl UnsafeUnpin for RelayError
impl !UnwindSafe for RelayError
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
Mutably borrows from an owned value. Read more
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.