google_analytics_api_ga4/error/
mod.rs1use std::fmt::{Debug, Display, Formatter};
2
3#[derive(Debug, Clone)]
4pub enum GoogleApiError {
5 Connection(String),
7 JsonParse(String),
9 Response(u16, String),
11}
12
13impl Display for GoogleApiError {
14 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
15 match self {
16 GoogleApiError::Connection(e) => write!(f, "connection error: {}", e),
17 GoogleApiError::JsonParse(e) => write!(f, "json parse error: {}", e),
18 GoogleApiError::Response(status, body) => {
19 write!(f, "api error (status {}): {}", status, body)
20 }
21 }
22 }
23}
24
25impl std::error::Error for GoogleApiError {}