use std::path::PathBuf;
use crate::EnvironmentBase;
use thiserror::Error;
#[derive(Debug, Error, Clone, PartialEq, Eq)]
pub enum CommandError {
#[error("command program must not be empty")]
EmptyProgram,
#[error("command program must not contain a NUL character")]
ProgramContainsNul,
#[error("command argument must not contain a NUL character")]
ArgumentContainsNul,
#[error("working directory must not be empty")]
EmptyWorkingDirectory,
#[error("working directory must not contain a NUL character")]
WorkingDirectoryContainsNul,
#[error(
"working directory must not contain parent traversal: {}",
path.display()
)]
WorkingDirectoryParentTraversal {
path: PathBuf,
},
#[error("environment variable name must not be empty")]
EmptyEnvironmentName,
#[error("environment variable name must not contain '='")]
EnvironmentNameContainsEquals,
#[error("environment variable name must not contain a NUL character")]
EnvironmentNameContainsNul,
#[error("environment variable value must not contain a NUL character")]
EnvironmentValueContainsNul,
#[error("environment variable pattern must not be empty")]
EmptyEnvironmentPattern,
#[error("environment variable pattern must not contain a NUL character")]
EnvironmentPatternContainsNul,
#[error("environment variable pattern must not contain '='")]
EnvironmentPatternContainsEquals,
#[error("environment input base {supplied:?} is broader than required base {required:?}")]
EnvironmentBaseTooPermissive {
required: EnvironmentBase,
supplied: EnvironmentBase,
},
}