nitiwiki display error before crashing when a template got missing
authorAlexandre Terrasa <alexandre@moz-code.org>
Thu, 21 May 2015 18:11:04 +0000 (14:11 -0400)
committerAlexandre Terrasa <alexandre@moz-code.org>
Thu, 21 May 2015 18:11:04 +0000 (14:11 -0400)
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>

contrib/nitiwiki/src/wiki_base.nit

index 81dc157..b250071 100644 (file)
@@ -188,7 +188,10 @@ class Nitiwiki
        #
        # REQUIRE: `has_template`
        fun load_template(name: String): TemplateString do
-               assert has_template(name)
+               if not has_template(name) then
+                       message("Error: can't load template `{name}`", 0)
+                       exit 1
+               end
                var file = expand_path(config.root_dir, config.templates_dir, name)
                var tpl = new TemplateString.from_file(file)
                if tpl.has_macro("ROOT_URL") then