1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
//! The crate error type.
use std::path::PathBuf;
/// Result alias using the crate [`enum@Error`].
pub type Result<T> = std::result::Result<T, Error>;
/// Everything that can go wrong when driving Helm through a backend.
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum Error {
/// The `helm` binary could not be found or executed.
#[error("helm binary not found: {}", .0.display())]
BinaryNotFound(PathBuf),
/// The `helm` binary is older than Helm 4.
#[error("unsupported helm version {found}: helm-rs requires Helm 4.0.0 or newer")]
UnsupportedVersion {
/// The version the binary reported.
found: semver::Version,
},
/// Helm reported `release: not found`; carries Helm's error message.
#[error("release not found: {0}")]
ReleaseNotFound(String),
/// Helm reported that another install, upgrade or rollback is in progress.
#[error("another operation is in progress: {0}")]
OperationInProgress(String),
/// Helm gave up waiting (context deadline or wait timeout); carries Helm's error message.
#[error("timed out: {0}")]
Timeout(String),
/// The backend failed in a way that is not classified; the raw stderr is always kept.
#[error("helm failed (exit code {exit_code:?}): {stderr}")]
Backend {
/// The process exit code, `None` when killed by a signal.
exit_code: Option<i32>,
/// The raw standard error of the process.
stderr: String,
},
/// The output of a command could not be parsed.
#[error("cannot parse the output of `{command}`: {message}")]
Parse {
/// The command whose output was unparseable.
command: &'static str,
/// What was wrong with the output.
message: String,
},
/// The command cannot be expressed to Helm as given (for example a secret that Helm only
/// accepts on its command line); carries the reason.
#[error("invalid command: {0}")]
InvalidCommand(String),
/// An I/O error.
#[error(transparent)]
Io(#[from] std::io::Error),
/// A JSON error.
#[error(transparent)]
Json(#[from] serde_json::Error),
/// A YAML error.
#[error(transparent)]
Yaml(#[from] serde_norway::Error),
/// A chart could not be loaded.
#[error(transparent)]
Chart(#[from] crate::chart::Error),
/// Values failed validation against a chart schema.
#[error(transparent)]
Schema(#[from] crate::schema::Error),
/// A release record could not be decoded.
#[error(transparent)]
Release(#[from] crate::release::Error),
/// A rendered manifest could not be parsed.
#[error(transparent)]
Manifest(#[from] crate::manifest::Error),
/// The backend does not handle this command (named by its type).
#[error("the backend does not support {0}")]
Unsupported(&'static str),
}