Emit all error messages from Tera on init failure.

Resolves #369.
This commit is contained in:
Sergio Benitez 2017-08-02 16:58:55 -07:00
parent 72bed509b9
commit 944eaa3e3c
1 changed files with 6 additions and 5 deletions

View File

@ -22,14 +22,15 @@ impl Engine for Tera {
// Finally try to tell Tera about all of the templates. // Finally try to tell Tera about all of the templates.
if let Err(e) = tera.add_template_files(tera_templates) { if let Err(e) = tera.add_template_files(tera_templates) {
error!("Failed to initialize Tera templating."); error!("Failed to initialize Tera templating.");
for error in e.iter().skip(1) { for error in e.iter() {
info_!("{}.", error); info_!("{}", error);
}
return None
} }
None
} else {
Some(tera) Some(tera)
} }
}
fn render<C: Serialize>(&self, name: &str, context: C) -> Option<String> { fn render<C: Serialize>(&self, name: &str, context: C) -> Option<String> {
if self.get_template(name).is_err() { if self.get_template(name).is_err() {