summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars-3.5.5/examples/error.rs
blob: dcfcd0bc0d12001b7dff594e13a549a3b2a19f9e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
extern crate env_logger;
extern crate handlebars;
extern crate serde_json;

use std::error::Error;

use handlebars::Handlebars;

fn main() -> Result<(), Box<dyn Error>> {
    env_logger::init();
    let mut handlebars = Handlebars::new();

    // template not found
    handlebars
        .register_template_file("notfound", "./examples/error/notfound.hbs")
        .unwrap_or_else(|e| println!("{}", e));

    // an invalid template
    handlebars
        .register_template_file("error", "./examples/error/error.hbs")
        .unwrap_or_else(|e| println!("{}", e));

    Ok(())
}