#[non_exhaustive]pub enum PolicyError {
Parse(Error),
Version {
found: u32,
supported: u32,
},
MissingVersion {
supported: u32,
},
DuplicateId(String),
EmptyRule(String),
EmptyPattern,
BadGlob {
pattern: String,
error: Error,
},
BadShellPattern {
pattern: String,
},
OldAndNewName {
old: &'static str,
new: &'static str,
},
Rule {
rule: String,
problem: String,
},
}Expand description
Why a policy file cannot be used. Any of these keeps guard from deciding.
Messages include their cause, so no variant also exposes it as source:
a chained report ({:#}) would print it twice.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Parse(Error)
The file is not valid YAML or does not fit the schema (of
SUPPORTED_VERSION, the one it declares: another is
PolicyError::Version). The message names the field.
Version
The version key names a schema this build does not know (ADR-103).
MissingVersion
The document has no version key (ADR-103).
DuplicateId(String)
Two rule groups share an id.
EmptyRule(String)
A rule group lists no patterns.
EmptyPattern
A pattern is empty (or only !/$).
BadGlob
A glob does not compile.
BadShellPattern
A shell pattern does not tokenise (unbalanced quotes, a here-document).
OldAndNewName
The file has both ask: and review: (ADR-053): ask is the old name
of review, and which list was meant cannot be told.
Rule
A rule group or executables entry is invalid; problem says why.
Trait Implementations§
Source§impl Debug for PolicyError
impl Debug for PolicyError
Source§impl Display for PolicyError
impl Display for PolicyError
Source§impl Error for PolicyError
impl Error for PolicyError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()