diff --git a/hornbeam/src/interpreted.rs b/hornbeam/src/interpreted.rs index 228d7b9..f75c640 100644 --- a/hornbeam/src/interpreted.rs +++ b/hornbeam/src/interpreted.rs @@ -23,6 +23,7 @@ pub use hornbeam_interpreter::Params; use crate::interpreted::hot_reload::start_hot_reloader; pub use lazy_static::lazy_static; +use tokio::io; #[cfg(feature = "hot_reload")] pub mod hot_reload; @@ -100,7 +101,11 @@ fn load_new_template_system( translation_dir: &Path, ) -> Result, InterpreterError> { let localisation_system = FluentLocalisationSystem::new(translation_dir, default_locale) - .expect("Failed to create Fluent localisation system for Hornbeam environment"); + .map_err(|err| { + InterpreterError::TemplateFindError(format!( + "Failed to create Fluent localisation system for Hornbeam environment: {err:?}" + )) + })?; let mut templates = LoadedTemplates::new(localisation_system); templates.load_templates_from_dir(template_dir)?; Ok(templates)