Skip to main content

geocoder_core/
error.rs

1use thiserror::Error;
2
3#[derive(Debug, Error)]
4pub enum GeocoderError {
5    #[error("I/O error: {0}")]
6    Io(#[from] std::io::Error),
7
8    #[error("JSON error: {0}")]
9    Json(#[from] serde_json::Error),
10
11    #[error("FST error: {0}")]
12    Fst(#[from] fst::Error),
13
14    #[error("Geohash error: {0}")]
15    Geohash(#[from] geohash::GeohashError),
16
17    #[error("Invalid index: {0}")]
18    InvalidIndex(&'static str),
19
20    #[error("The index was built with a profile this build does not know")]
21    UnknownProfile,
22
23    #[error(
24        "The index was built with profile {profile} v{index}, this build has v{code}: rebuild the index"
25    )]
26    ProfileVersion {
27        profile: String,
28        index: u32,
29        code: u32,
30    },
31}