oxigdal_services/ogc_features/error.rs
1//! Error types for the OGC Features API layer.
2
3use thiserror::Error;
4
5/// Errors produced by the OGC Features API layer
6#[derive(Debug, Error)]
7pub enum FeaturesError {
8 /// Collection with the given ID was not found
9 #[error("Collection not found: {0}")]
10 CollectionNotFound(String),
11
12 /// Bounding box is malformed or contains invalid values
13 #[error("Invalid bbox: {0}")]
14 InvalidBbox(String),
15
16 /// Datetime string could not be parsed
17 #[error("Invalid datetime: {0}")]
18 InvalidDatetime(String),
19
20 /// CRS URI is not supported or recognised
21 #[error("Invalid CRS: {0}")]
22 InvalidCrs(String),
23
24 /// Client requested more features than the server allows
25 #[error("Limit {requested} exceeds maximum allowed {max}")]
26 LimitExceeded {
27 /// Requested limit
28 requested: u32,
29 /// Server-side maximum
30 max: u32,
31 },
32
33 /// Serde JSON deserialisation / serialisation failure
34 #[error("JSON error: {0}")]
35 SerdeError(#[from] serde_json::Error),
36
37 /// CQL2 expression parse failure
38 #[error("CQL2 parse error: {0}")]
39 CqlParseError(String),
40}