cageforge_command/
error.rs1use std::path::PathBuf;
7
8use crate::EnvironmentBase;
9use thiserror::Error;
10
11#[derive(Debug, Error, Clone, PartialEq, Eq)]
13pub enum CommandError {
14 #[error("command program must not be empty")]
16 EmptyProgram,
17 #[error("command program must not contain a NUL character")]
19 ProgramContainsNul,
20 #[error("command argument must not contain a NUL character")]
22 ArgumentContainsNul,
23 #[error("working directory must not be empty")]
25 EmptyWorkingDirectory,
26 #[error("working directory must not contain a NUL character")]
28 WorkingDirectoryContainsNul,
29 #[error(
31 "working directory must not contain parent traversal: {}",
32 path.display()
33 )]
34 WorkingDirectoryParentTraversal {
35 path: PathBuf,
37 },
38 #[error("environment variable name must not be empty")]
40 EmptyEnvironmentName,
41 #[error("environment variable name must not contain '='")]
43 EnvironmentNameContainsEquals,
44 #[error("environment variable name must not contain a NUL character")]
46 EnvironmentNameContainsNul,
47 #[error("environment variable value must not contain a NUL character")]
49 EnvironmentValueContainsNul,
50 #[error("environment variable pattern must not be empty")]
52 EmptyEnvironmentPattern,
53 #[error("environment variable pattern must not contain a NUL character")]
55 EnvironmentPatternContainsNul,
56 #[error("environment variable pattern must not contain '='")]
58 EnvironmentPatternContainsEquals,
59 #[error("environment input base {supplied:?} is broader than required base {required:?}")]
61 EnvironmentBaseTooPermissive {
62 required: EnvironmentBase,
64 supplied: EnvironmentBase,
66 },
67}