#[non_exhaustive]pub enum UnifiError {
Show 18 variants
MissingUrl,
MissingApiKey,
ClientBuild(Error),
Timeout {
method: String,
url: String,
source: Error,
},
Connect {
method: String,
url: String,
source: Error,
},
Request {
method: String,
url: String,
source: Error,
},
Unauthorized(String),
Forbidden {
method: String,
url: String,
},
NotFound {
method: String,
url: String,
},
RateLimited {
method: String,
url: String,
retry_after: Option<Duration>,
},
EmptyBody {
method: String,
url: String,
},
Decode {
url: String,
source: Error,
},
UnexpectedStatus {
status: u16,
url: String,
body: Box<Value>,
},
UnknownAction(String),
InvalidRequest {
context: String,
message: String,
},
PathTemplate(String),
ConnectorPath(String),
HybridRouting(String),
}Expand description
Everything that can go wrong talking to a UniFi controller.
Marked #[non_exhaustive]: this crate is meant to be published and
consumed externally, so a caller that matches on this must include a
wildcard arm — adding a new variant (e.g. a future status-class split)
must never be a semver-breaking change for downstream code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingUrl
UnifiConfig::url was empty.
MissingApiKey
UnifiConfig::api_key was empty.
ClientBuild(Error)
The underlying reqwest::Client failed to build.
Timeout
The request exceeded the client timeout.
Fields
source: ErrorUnderlying transport error (kept for Error::source() chain-walking
even though the message above doesn’t repeat its text).
Connect
The controller could not be reached (DNS, TCP, or TLS handshake failure).
Fields
source: ErrorUnderlying transport error (kept for Error::source() chain-walking
even though the message above doesn’t repeat its text).
Request
A transport-level failure other than timeout or connect.
Fields
source: ErrorUnderlying transport error.
The controller rejected the API key (HTTP 401). Unlike the other
status-class variants this has no method field: a rejected key is
rejected the same way for every verb, so there’s nothing extra to
carry — not an oversight.
Tuple Fields
Full request URL.
Forbidden
The API key is valid but lacks permission for the request (HTTP 403).
NotFound
The controller has no such endpoint (HTTP 404).
RateLimited
The controller rejected the request for exceeding its rate limit (HTTP 429).
Fields
EmptyBody
A GET returned a successful status with no body, where a JSON body was expected.
Decode
The response body was not valid JSON.
UnexpectedStatus
The controller returned a non-success status not covered by a more specific variant.
Fields
UnknownAction(String)
crate::ActionDispatcher::execute was asked to run an action that has no
registered crate::capabilities::Capability.
InvalidRequest
A request’s parameters were malformed (wrong type, wrong API family, unknown
hybrid target, etc). context is an action name or an HTTP method + path,
whichever the caller had on hand.
Fields
PathTemplate(String)
Path-template substitution failed (unmatched brace, missing parameter, wrong type).
ConnectorPath(String)
The *path connector wildcard segment failed validation (traversal, encoded
separators, or outside the allowed API prefixes).
HybridRouting(String)
Hybrid action routing (official vs. internal) failed.
Trait Implementations§
Source§impl Debug for UnifiError
impl Debug for UnifiError
Source§impl Display for UnifiError
impl Display for UnifiError
Source§impl Error for UnifiError
impl Error for UnifiError
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()