platz_sdk/client/
error.rs

1#[derive(Debug, thiserror::Error)]
2pub enum PlatzClientError {
3    #[error(r###"Could not find any Platz config. Use one of the following methods:
4    1. Set the PLATZ_URL and PLATZ_API_TOKEN environment variables.
5    2. Use "platz/config.toml" configuration file on your config directory.
6    2. When running from inside a Platz deployment, mount the "platz-creds" secret to /var/run/secrets/platz.json .
7"###)]
8    NoConfigFound,
9
10    #[error("OS error while trying to read config: {0:?}")]
11    ConfigReadError(std::io::ErrorKind),
12
13    #[error("Error parsing configuration file: {0:?}")]
14    ConfigDeserializationError(toml::de::Error),
15
16    #[error("Error in configuration file: {0:?}")]
17    ConfigTomlError(&'static str),
18
19    #[error("Error parsing {0} environment variable")]
20    EnvVarParseError(&'static str),
21
22    #[error("Error parsing URL from mounted credentials: {0}")]
23    MountedUrlParseError(url::ParseError),
24
25    #[error("Error parsing token expiry from mounted credentials: {0}")]
26    MountedExpiryParseError(chrono::ParseError),
27
28    #[error("Error joining URL: {0}")]
29    UrlJoinError(url::ParseError),
30
31    #[error("Error building client: {0}")]
32    ReqwestError(#[from] reqwest::Error),
33
34    #[error("HTTP Error: {0}")]
35    HttpError(String),
36
37    #[error("Error creating authorization header")]
38    ErrorCreatingAuthHeader,
39
40    #[error("Can't paginate request since the RequestBuilder can't be cloned")]
41    CannotPaginate,
42
43    #[error("Expected exactly one item, got none")]
44    ExpectedOneGotNone,
45
46    #[error("Expected exactly one item, got {0}")]
47    ExpectedOneGotMany(usize),
48}