From b7818dddc1cc83f212944d7ed69754689247b06c Mon Sep 17 00:00:00 2001 From: Olivier Date: Wed, 19 Jun 2024 23:51:12 +0100 Subject: [PATCH] Improve error message on creation of interpreted environment Signed-off-by: Olivier --- hornbeam/src/interpreted.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/hornbeam/src/interpreted.rs b/hornbeam/src/interpreted.rs index 90e93cb..f76c9d8 100644 --- a/hornbeam/src/interpreted.rs +++ b/hornbeam/src/interpreted.rs @@ -72,12 +72,16 @@ pub fn new_template_manager( successful.expect(&format!("Could not find Hornbeam templates/translations: tried looking in {try_paths:?} and no HORNBEAM_BASE environment variable set!")) }; - let template_sys = load_new_template_system( + let template_sys = match load_new_template_system( default_locale, &base_dir.join("templates"), &base_dir.join("translations"), - ) - .expect("Failed to create Hornbeam environment!"); + ) { + Ok(v) => v, + Err(err) => { + panic!("Failed to create Hornbeam environment! {err}"); + } + }; let templates = Arc::new(ArcSwap::new(Arc::new(template_sys))); #[cfg(feature = "hot_reload")]