helm-rs 0.1.2

Typed Rust API for Helm 4: swappable backends, native chart, values and release reading
Documentation
//! 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),
}