pub enum TemplateError {
Io(Error),
UndefinedVariable(String),
Syntax(SyntaxError),
MissingParams(Vec<String>),
TypeMismatch {
name: String,
expected: String,
actual: String,
actual_value: String,
},
UnknownFilter(String),
IncludeNotFound(String),
DeclarationsMutated {
details: String,
},
ExtraParams(Vec<String>),
Panic(String),
}Expand description
Errors produced by the template engine.
Variants§
Io(Error)
I/O error while loading a template file.
UndefinedVariable(String)
A referenced variable was not found in the context.
Syntax(SyntaxError)
Syntax error in the template.
MissingParams(Vec<String>)
Missing required parameters from frontmatter.
TypeMismatch
Type mismatch between declaration and value.
Fields
UnknownFilter(String)
Unknown filter name.
IncludeNotFound(String)
Include file not found.
DeclarationsMutated
Parameter declarations were mutated at runtime.
Template frontmatter params: declarations are fixed at compile
time. If a runtime-reloaded template has different declarations, this
error is returned — the template body may be changed freely, but the
parameter contract must remain stable.
ExtraParams(Vec<String>)
Extra (undeclared) parameters were passed in the context.
The template engine is strict by default: only parameters declared
in frontmatter may be passed. Use allow_extra_params on the
render call to suppress this check.
Panic(String)
Template rendering halted by an explicit {% panic(...) %} statement.
Implementations§
Source§impl TemplateError
impl TemplateError
Sourcepub fn kind(&self) -> ErrorKind
pub fn kind(&self) -> ErrorKind
Return the stable, data-independent ErrorKind of this error.
Unlike matching on the enum variants (which also carry payloads), this
gives a lightweight, Copy discriminant that language bindings can map
onto their own typed-error hierarchies without parsing the display
message.
Trait Implementations§
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
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()