1use thiserror::Error;
2
3#[derive(Error, Debug)]
5pub enum ClientError {
6 #[error("The Vault server returned an error (status code {code})")]
7 APIError { code: u16, errors: Vec<String> },
8 #[error("Failed to find file: {path}")]
9 FileNotFoundError { path: String },
10 #[error("Error reading file: {path}")]
11 FileReadError {
12 source: std::io::Error,
13 path: String,
14 },
15 #[error("Error writing file: {path}")]
16 FileWriteError {
17 source: std::io::Error,
18 path: String,
19 },
20 #[error("Invalid login method")]
21 InvalidLoginMethodError,
22 #[error("Error parsing value into JSON")]
23 JsonParseError { source: serde_json::error::Error },
24 #[error("Error parsing CA certificate as PEM encoded certificate: {path}")]
25 ParseCertificateError {
26 source: reqwest::Error,
27 path: String,
28 },
29 #[error("The request returned an empty response")]
30 ResponseEmptyError,
31 #[error("The result contained an empty data field")]
32 ResponseDataEmptyError,
33 #[error("Error parsing response wrapping result")]
34 ResponseWrapError,
35 #[error("Error configuring REST client")]
36 RestClientBuildError { source: reqwest::Error },
37 #[error("An error occurred with the request")]
38 RestClientError {
39 #[from]
40 source: rustify::errors::ClientError,
41 },
42 #[error("The wrapped response doesn't exist or is not longer valid")]
43 WrapInvalidError,
44 #[error("The parameters given to the endpoint didn't update anything")]
45 InvalidUpdateParameter,
46}