#[non_exhaustive]pub enum Error {
Show 15 variants
InvalidUrl(ParseError),
InvalidEndpoint(String),
InvalidWebsiteId {
value: String,
source: Error,
},
InvalidUserAgent(InvalidHeaderValue),
EmptyUserAgent,
InvalidCacheHeader(InvalidHeaderValue),
InvalidProperties(String),
InvalidEventName(String),
InvalidMetric {
name: &'static str,
expected: &'static str,
value: f64,
},
InvalidTrack(String),
BatchTooLarge {
len: usize,
max: usize,
},
MismatchedBatch,
Http(Error),
Api(ApiError),
Decode {
status: StatusCode,
source: Error,
body: String,
},
}Expand description
Errors produced while configuring the client or sending analytics.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
InvalidUrl(ParseError)
An endpoint URL could not be parsed.
InvalidEndpoint(String)
The endpoint URL is not an HTTP(S) URL or cannot be used as a base URL.
InvalidWebsiteId
The website ID is not a UUID accepted by Umami.
InvalidUserAgent(InvalidHeaderValue)
The configured HTTP user-agent is not a valid header value.
EmptyUserAgent
Umami requires a non-empty HTTP user-agent.
InvalidCacheHeader(InvalidHeaderValue)
A cache value returned by Umami could not be represented as a header.
InvalidProperties(String)
Event properties could not be represented as a JSON object.
InvalidEventName(String)
A custom event name is invalid.
InvalidMetric
A performance metric is outside Umami’s accepted range.
Fields
InvalidTrack(String)
A track contains fields that do not apply to its kind.
BatchTooLarge
Umami accepts at most 500 items in one batch.
MismatchedBatch
A batch received an event created by another client or session.
Http(Error)
The HTTP client failed to build or send a request.
Api(ApiError)
Umami returned a non-successful HTTP status.
Decode
A successful response was not valid JSON for the expected response type.
Implementations§
Source§impl Error
impl Error
Sourcepub fn status(&self) -> Option<StatusCode>
pub fn status(&self) -> Option<StatusCode>
Returns the HTTP status when this error came from an Umami response.
Sourcepub fn is_retryable(&self) -> bool
pub fn is_retryable(&self) -> bool
Returns whether this error is retryable under a conservative policy.
Timeouts, connection failures, HTTP 429, and server errors are considered retryable. The crate does not retry automatically because a retry can duplicate an analytics event.
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()