1use lat_long::Error as LatLongError;
7use reqwest::Error as RequestError;
8use reqwest::StatusCode;
9use rfham_core::error::CoreError;
10use serde_json::Error as JsonError;
11use thiserror::Error;
12
13#[derive(Debug, Error)]
21pub enum GeoError {
22 #[error("I/O error: {0}")]
23 Io(#[from] std::io::Error),
24
25 #[error("An error occured converting latitude/longitude value; error: {0}")]
26 LatLong(#[from] LatLongError),
27
28 #[error("Cannot produce a Maidenhead grid locator for either North/South poles")]
29 NoPolarGrid,
30
31 #[error("An error occured in a Geo-IP provider; error: {0}")]
32 GeoIpProvider(String),
33
34 #[error("An HTTP service returned non-success code ; status-code: {0}")]
35 Http(StatusCode),
36
37 #[error("An error occured calling an HTTP service; status-code: {0}")]
38 Reqwest(#[from] RequestError),
39
40 #[error("Core library error detected; error: {0}")]
41 Core(#[from] CoreError),
42
43 #[error("An error occured serializing/deserializing JSON; error: {0}")]
44 Serialization(#[from] JsonError),
45}
46
47pub type GeoResult<T> = std::result::Result<T, GeoError>;