#[non_exhaustive]pub enum GotifyError {
MissingUrl,
MissingClientToken,
MissingAppToken,
ClientBuild(Error),
Unauthorized(String),
NotFound {
method: String,
url: String,
},
RateLimited {
method: String,
url: String,
retry_after: Option<Duration>,
},
UnexpectedStatus {
status: u16,
url: String,
body: Box<Value>,
},
Decode {
url: String,
source: Error,
},
Timeout {
method: String,
url: String,
source: Error,
},
Connect {
method: String,
url: String,
source: Error,
},
Request {
method: String,
url: String,
source: Error,
},
}Expand description
Everything that can go wrong talking to a Gotify server.
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 must never be a semver break for
downstream code.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
MissingUrl
crate::GotifyConfig::url was empty at crate::GotifyClient::new.
MissingClientToken
The requested operation needs a client token
(crate::GotifyConfig::client_token), but none is configured.
Client tokens authenticate management operations (messages,
applications, clients, current user) — create one under Clients
in the Gotify web UI.
MissingAppToken
crate::GotifyClient::send_message needs an app token
(crate::GotifyConfig::app_token), but none is configured. App
tokens are distinct from client tokens — create one under
Applications in the Gotify web UI.
ClientBuild(Error)
The underlying reqwest::Client failed to construct.
HTTP 401 — the configured token was rejected.
NotFound
HTTP 404.
RateLimited
HTTP 429.
Fields
UnexpectedStatus
Any other non-success status. body is JSON when the response was
JSON, otherwise the raw text; boxed to keep this enum small.
Fields
Decode
The response body wasn’t valid JSON on an otherwise-successful status.
Timeout
Request timed out.
Fields
source: ErrorThe underlying transport error.
Connect
Failed to connect to the configured URL.
Fields
source: ErrorThe underlying transport error.
Request
Any other transport-level failure.
Trait Implementations§
Source§impl Debug for GotifyError
impl Debug for GotifyError
Source§impl Display for GotifyError
impl Display for GotifyError
Source§impl Error for GotifyError
impl Error for GotifyError
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()