stac_types/
error.rs

1use crate::Version;
2use thiserror::Error;
3
4#[derive(Error, Debug)]
5pub enum Error {
6    /// Returned when a STAC object has the wrong type field.
7    #[error("incorrect type: expected={expected}, actual={actual}")]
8    IncorrectType {
9        /// The actual type field on the object.
10        actual: String,
11
12        /// The expected value.
13        expected: String,
14    },
15
16    /// [std::io::Error]
17    #[error(transparent)]
18    Io(#[from] std::io::Error),
19
20    /// There is not an href, when an href is required.
21    #[error("no href")]
22    NoHref,
23
24    /// This is not a JSON object.
25    #[error("json value is not an object")]
26    NotAnObject(serde_json::Value),
27
28    /// [serde_json::Error]
29    #[error(transparent)]
30    SerdeJson(#[from] serde_json::Error),
31
32    /// Unsupported migration.
33    #[error("unsupported migration: {0} to {1}")]
34    UnsupportedMigration(Version, Version),
35
36    /// [url::ParseError]
37    #[error(transparent)]
38    UrlParse(#[from] url::ParseError),
39}