summaryrefslogtreecommitdiffstats
path: root/vendor/handlebars-3.5.5/examples/error.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:35 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-04 12:41:35 +0000
commit7e5d7eea9c580ef4b41a765bde624af431942b96 (patch)
tree2c0d9ca12878fc4525650aa4e54d77a81a07cc09 /vendor/handlebars-3.5.5/examples/error.rs
parentAdding debian version 1.70.0+dfsg1-9. (diff)
downloadrustc-7e5d7eea9c580ef4b41a765bde624af431942b96.tar.xz
rustc-7e5d7eea9c580ef4b41a765bde624af431942b96.zip
Merging upstream version 1.70.0+dfsg2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'vendor/handlebars-3.5.5/examples/error.rs')
-rw-r--r--vendor/handlebars-3.5.5/examples/error.rs24
1 files changed, 24 insertions, 0 deletions
diff --git a/vendor/handlebars-3.5.5/examples/error.rs b/vendor/handlebars-3.5.5/examples/error.rs
new file mode 100644
index 000000000..dcfcd0bc0
--- /dev/null
+++ b/vendor/handlebars-3.5.5/examples/error.rs
@@ -0,0 +1,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(())
+}