#[non_exhaustive]pub enum TemplateError {
NotFound {
name: String,
referenced_from: Option<String>,
searched: Vec<String>,
},
Unreadable {
name: String,
message: String,
},
SearchPath {
directory: String,
message: String,
},
Malformed {
file: String,
key: Option<String>,
message: String,
},
ChainConflict {
variable: String,
field: ChainField,
nearer: String,
nearer_value: &'static str,
farther: String,
farther_value: &'static str,
},
MalformedAnswers {
message: String,
},
UnknownAnswer {
names: Vec<String>,
},
MistypedAnswer {
name: String,
kind: VariableType,
expected: String,
problem: String,
},
MissingRequired {
names: Vec<String>,
},
Render {
file: Option<String>,
line: Option<usize>,
name: Option<String>,
message: String,
},
MalformedLoader {
message: String,
},
LoaderDigest {
stated: String,
computed: String,
},
}Expand description
Why a template could not be loaded, answered or rendered.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NotFound
A name or path the chain needs resolved to nothing.
Fields
Unreadable
A template that is there and could not be read — a permission, or a directory where a file was named.
SearchPath
A search path directory that is missing or is not a directory, refused before any template is looked for, so a mistyped one is not silently searched as empty.
Malformed
A chain file that is not a template this format reads.
Fields
ChainConflict
Two chain files declaring one variable with different types or items.
Fields
field: ChainFieldWhich field differs.
MalformedAnswers
An answers document that is not a mapping of answers.
UnknownAnswer
Answers naming no declared variable.
MistypedAnswer
An answer that is not a value of its variable’s type.
Fields
kind: VariableTypeIts type.
MissingRequired
Required variables no answer and no default covers.
Render
The render itself failed: an undefined name, or an error a filter or tag raised.
Fields
MalformedLoader
A template loader document that is not one this product reads.
LoaderDigest
A loader document stating a digest its chain does not compute.
Implementations§
Source§impl TemplateError
impl TemplateError
Sourcepub fn refuses_answers(&self) -> bool
pub fn refuses_answers(&self) -> bool
Whether this refuses the answers rather than the template: an answers document that
is not one, an answer to no declared variable or of the wrong type, and required
variables left unanswered. The command line exits 2 for these.
Trait Implementations§
Source§impl Clone for TemplateError
impl Clone for TemplateError
Source§impl Debug for TemplateError
impl Debug for TemplateError
Source§impl Display for TemplateError
impl Display for TemplateError
Source§impl Error for TemplateError
impl Error for TemplateError
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()