freedom_models/
error.rs

1#[cfg(feature = "serde")]
2use serde::Deserialize;
3
4#[cfg_attr(
5    feature = "serde",
6    derive(Deserialize),
7    serde(rename_all = "camelCase")
8)]
9#[derive(Debug, Clone, PartialEq, Eq)]
10#[cfg_attr(not(feature = "unstable"), non_exhaustive)]
11pub enum Error {
12    PaginatedInner,
13    PaginatedListMissing,
14    Link(String),
15}
16
17impl std::fmt::Display for Error {
18    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
19        match self {
20            Error::PaginatedInner => {
21                f.write_str("An item within the inner paginated structure failed to deserialize")
22            }
23            Error::PaginatedListMissing => {
24                f.write_str("The inner list of paginated elements is missing")
25            }
26            Error::Link(inner) => write!(f, "The link map failed to deserialize: {inner}"),
27        }
28    }
29}
30
31impl core::error::Error for Error {}