chiark / gitweb /
nwtemplates: Log a warning if there are no templates
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 14 May 2022 13:52:42 +0000 (14:52 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 14 May 2022 15:02:05 +0000 (16:02 +0100)
This is probably an installation or usage error.  Reporting that helps
if subsequently a template isn't found.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/nwtemplates.rs

index b49062e48c824abf6fa49f753fb1e3a040b5b24f..a492bddfed409c41525763d7959651a481274eec 100644 (file)
@@ -25,6 +25,11 @@ pub fn init() {
     .context("load tamplates")
     .with_context(|| nwtemplate_dir.to_string())?;
 
+  if tera.get_template_names().next().is_none() {
+    warn!("nwtemplates directory {:?} contains no templates!",
+          nwtemplate_dir);
+  }
+
   *guard = Some(State {
     tera,
   })