utiles_core/
errors.rs

1//! utiles-core errors mod
2
3use std::num::TryFromIntError;
4use thiserror::Error;
5
6/// Error type for utiles-core
7#[derive(Error, Debug)]
8pub enum UtilesCoreError {
9    /// Error with some string
10    #[error("{0}")]
11    AdHoc(String),
12
13    /// Error for parsing a tile
14    #[error("tile parse error: {0}")]
15    TileParseError(String),
16
17    /// Error for general parsing
18    #[error("parse error: {0}")]
19    ParseError(String),
20
21    /// Error on invalid tile-quadkey
22    #[error("invalid tile: {0}")]
23    InvalidTile(String),
24
25    /// Error on invalid tile-quadkey
26    #[error("invalid quadkey: {0}")]
27    InvalidQuadkey(String),
28
29    /// Error for invalid bbox (bounding-box)
30    #[error("invalid bbox: {0}")]
31    InvalidBbox(String),
32
33    /// Error for invalid `LngLat`
34    #[error("invalid lnglat: {0}")]
35    InvalidLngLat(String),
36
37    /// Error for invalid SRTM string
38    #[error("invalid SRTM string: {0}")]
39    InvalidSrtmString(String),
40
41    /// Error for invalid zoom between 0 and 32
42    #[error("invalid zoom(s): {0}")]
43    InvalidZoom(String),
44
45    /// Error for invalid projection
46    #[error("invalid projection: {0}")]
47    InvalidProjection(String),
48
49    /// Error for invalid json
50    #[error("invalid json: {0}")]
51    InvalidJson(String),
52
53    /// Error for when converting from lnglat to web mercator fails
54    #[error("conversion err: {0}")]
55    LngLat2WebMercator(String),
56
57    /// Error on unimplemented feature
58    #[error("Unimplemented: {0}")]
59    Unimplemented(String),
60
61    /// Error on serde io error
62    #[error("io error: {0}")]
63    SerdeJsonError(#[from] serde_json::Error),
64
65    /// Try from int
66    #[error("try-from-int: {0}")]
67    TryFromIntError(#[from] TryFromIntError),
68}
69
70/// Result type for utiles-core; really a type alias for `Result<T, UtilesCoreError>`
71pub type UtilesCoreResult<T> = Result<T, UtilesCoreError>;