mvt/
error.rs

1// error.rs
2//
3// Copyright (c) 2019-2022  Minnesota Department of Transportation
4//
5use protobuf::Error as ProtobufError;
6
7/// MVT Error types
8#[non_exhaustive]
9#[derive(Debug, thiserror::Error)]
10pub enum Error {
11    /// The tile already contains a layer with the specified name.
12    #[error("Duplicate name")]
13    DuplicateName(),
14
15    /// The layer extent does not match the tile extent.
16    #[error("Wrong layer extent")]
17    WrongExtent(),
18
19    /// The tile ID is invalid.
20    #[error("Invalid tile ID")]
21    InvalidTid(),
22
23    /// The geometry does not meet criteria of the specification.
24    #[error("Invalid geometry data")]
25    InvalidGeometry(),
26
27    /// Invalid float value
28    #[error("Invalid float value")]
29    InvalidValue(),
30
31    /// Error while encoding protobuf data.
32    #[error("Protobuf error {0}")]
33    Protobuf(#[from] ProtobufError),
34}
35
36/// MVT Result
37pub type Result<T> = std::result::Result<T, Error>;