pub enum Error {
Show 16 variants
Authentication {
message: String,
},
TwoFactorRequired,
SessionExpired,
InvalidApiKey,
WrongAuthStrategy {
expected: String,
got: String,
},
Transport(Error),
InvalidUrl(ParseError),
Timeout {
timeout_secs: u64,
},
Tls(String),
RateLimited {
retry_after_secs: u64,
},
Integration {
message: String,
code: Option<String>,
status: u16,
},
LegacyApi {
message: String,
},
WebSocketConnect(String),
WebSocketClosed {
code: u16,
reason: String,
},
Deserialization {
message: String,
body: String,
},
UnsupportedOperation(&'static str),
}Expand description
Top-level error type for the unifly-api crate.
Covers every failure mode across all API surfaces:
authentication, transport, Integration API, Legacy API, WebSocket, and cloud.
unifly-core maps these into user-facing diagnostics.
Variants§
Authentication
Login failed (wrong credentials, account locked, etc.)
TwoFactorRequired
2FA token required but not provided.
SessionExpired
Session has expired (cookie expired or revoked).
InvalidApiKey
Invalid API key (rejected by controller).
WrongAuthStrategy
Wrong credential type for the requested operation.
Transport(Error)
HTTP transport error (connection refused, DNS failure, etc.)
InvalidUrl(ParseError)
URL parsing error.
Timeout
Request timed out.
Tls(String)
TLS handshake or certificate error.
RateLimited
Rate limited by the cloud API. Includes retry-after in seconds.
Integration
Structured error from the Integration API.
LegacyApi
Error from the legacy API (parsed from the {meta: {rc, msg}} envelope).
WebSocketConnect(String)
WebSocket connection failed.
WebSocketClosed
WebSocket closed unexpectedly.
Deserialization
JSON deserialization failed, with the raw body for debugging.
UnsupportedOperation(&'static str)
Operation not supported on this controller platform.
Implementations§
Source§impl Error
impl Error
Sourcepub fn is_auth_expired(&self) -> bool
pub fn is_auth_expired(&self) -> bool
Returns true if this error indicates auth has expired
and re-authentication might resolve it.
Sourcepub fn is_transient(&self) -> bool
pub fn is_transient(&self) -> bool
Returns true if this is a transient error worth retrying.
Sourcepub fn is_not_found(&self) -> bool
pub fn is_not_found(&self) -> bool
Returns true if this is a “not found” error.
Sourcepub fn api_error_code(&self) -> Option<&str>
pub fn api_error_code(&self) -> Option<&str>
Extract the API error code, if available.
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
Source§impl From<ParseError> for Error
impl From<ParseError> for Error
Source§fn from(source: ParseError) -> Self
fn from(source: ParseError) -> Self
Auto Trait Implementations§
impl Freeze for Error
impl !RefUnwindSafe for Error
impl Send for Error
impl Sync for Error
impl Unpin for Error
impl UnsafeUnpin for Error
impl !UnwindSafe 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> 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.