#[non_exhaustive]pub enum Error {
Show 16 variants
Configuration(String),
Unauthorized {
method: Method,
url: Box<Url>,
},
Forbidden {
method: Method,
url: Box<Url>,
},
HttpStatus {
method: Method,
url: Box<Url>,
status: StatusCode,
},
Transport {
method: Method,
url: Box<Url>,
source: Error,
},
ResponseTooLarge {
method: Method,
url: Box<Url>,
limit: usize,
content_length: Option<u64>,
},
Encode {
operation: &'static str,
source: Error,
},
Api {
method: Method,
url: Box<Url>,
message: String,
},
Decode {
method: Method,
url: Box<Url>,
source: Error,
},
Utf8 {
method: Method,
url: Box<Url>,
source: FromUtf8Error,
},
WebSocketConnectTimeout {
url: Box<Url>,
timeout: Duration,
},
WebSocket {
url: Box<Url>,
source: Box<Error>,
},
Proxy {
scheme: ProxyScheme,
url: Box<Url>,
source: Box<ProxyError>,
},
EventDecode {
message_type: Option<String>,
source: Error,
},
UnexpectedWebSocketFrame {
url: Box<Url>,
kind: &'static str,
},
MissingObject {
method: Method,
url: Box<Url>,
},
}Expand description
Errors returned by the SDK.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Configuration(String)
The client configuration is invalid.
The panel rejected the caller’s credentials or session.
Fields
HTTP method used for the request.
Request URL.
Forbidden
The panel rejected a request, commonly due to an invalid CSRF token.
HttpStatus
The panel returned an unsuccessful HTTP status.
Fields
status: StatusCodeResponse status.
Transport
The request could not be sent or its body could not be read.
Fields
ResponseTooLarge
The response body exceeded the configured in-memory size limit.
Fields
Encode
A request value could not be encoded in the endpoint’s wire format.
Fields
Api
The panel returned HTTP success with success: false.
Fields
Decode
The panel response did not match the documented schema.
Fields
Utf8
A text endpoint returned bytes that are not valid UTF-8.
Fields
source: FromUtf8ErrorUnderlying UTF-8 decoding error.
WebSocketConnectTimeout
Establishing the authenticated WebSocket exceeded the configured connection timeout.
WebSocket
A WebSocket handshake or frame operation failed.
Proxy
An explicit proxy could not establish a WebSocket tunnel.
Fields
scheme: ProxySchemeProxy protocol in use. The proxy endpoint is deliberately omitted.
source: Box<ProxyError>Underlying proxy transport or negotiation failure.
EventDecode
A WebSocket text message did not match its source-defined JSON shape.
Fields
UnexpectedWebSocketFrame
The panel sent a data-frame format not used by the v3.8.5 protocol.
MissingObject
A successful response omitted its documented obj value.
Implementations§
Source§impl Error
impl Error
Sourcepub const fn status(&self) -> Option<StatusCode>
pub const fn status(&self) -> Option<StatusCode>
Returns the HTTP status that caused this error, when available.
Authentication errors report 401 or 403 even though they have dedicated
variants. Application-level Error::Api responses used HTTP success
and therefore return None.
Sourcepub const fn method(&self) -> Option<&Method>
pub const fn method(&self) -> Option<&Method>
Returns the HTTP method associated with the failed operation.
Sourcepub fn url(&self) -> Option<&Url>
pub fn url(&self) -> Option<&Url>
Returns the request or WebSocket URL associated with the failure.
Returns true when authentication must be supplied or refreshed.
Sourcepub const fn is_forbidden(&self) -> bool
pub const fn is_forbidden(&self) -> bool
Returns true when the operation was rejected with HTTP 403.
Sourcepub const fn is_rate_limited(&self) -> bool
pub const fn is_rate_limited(&self) -> bool
Returns true when the panel asked the caller to slow down.
Sourcepub const fn is_response_too_large(&self) -> bool
pub const fn is_response_too_large(&self) -> bool
Returns true when the response body exceeded its configured limit.
Sourcepub const fn response_body_limit(&self) -> Option<usize>
pub const fn response_body_limit(&self) -> Option<usize>
Returns the configured response body limit that was exceeded.
Sourcepub const fn advertised_content_length(&self) -> Option<u64>
pub const fn advertised_content_length(&self) -> Option<u64>
Returns the server-advertised Content-Length for an oversized body.
Sourcepub fn is_server_error(&self) -> bool
pub fn is_server_error(&self) -> bool
Returns true for an HTTP 5xx response.
Sourcepub fn is_timeout(&self) -> bool
pub fn is_timeout(&self) -> bool
Returns true when an HTTP or WebSocket transport timed out.
Trait Implementations§
Source§impl Error for Error
impl Error for Error
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 Error
impl !UnwindSafe for Error
impl Freeze for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
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
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more