diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2011-07-21 01:04:53 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2011-07-21 01:04:53 +0000 |
commit | 2e618aaf294832b8b7cbfaa31d82f16d350b30c6 (patch) | |
tree | 05aec6c2bf7c456d660500d0dea124bb3061e9f3 /libs/web/luasrc/template.lua | |
parent | d970d7bd27cf9f4b6cdbec5737ed72291c0896d2 (diff) |
libs/web: more verbose faults
Diffstat (limited to 'libs/web/luasrc/template.lua')
-rw-r--r-- | libs/web/luasrc/template.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libs/web/luasrc/template.lua b/libs/web/luasrc/template.lua index 80a3206af5..962c2ea886 100644 --- a/libs/web/luasrc/template.lua +++ b/libs/web/luasrc/template.lua @@ -78,7 +78,10 @@ function Template.__init__(self, name) -- If we have no valid template throw error, otherwise cache the template if not self.template then - error(err) + error("Failed to load template '" .. name .. "'.\n" .. + "Error while parsing template '" .. sourcefile .. "'.\n" .. + "A syntax error occured near '" .. + (err or "(nil)"):gsub("\t", "\\t"):gsub("\n", "\\n") .. "'.") else self.cache[name] = self.template end @@ -99,6 +102,7 @@ function Template.render(self, scope) -- Now finally render the thing local stat, err = util.copcall(self.template) if not stat then - error("Error in template %s: %s" % {self.name, err}) + error("Failed to execute template '" .. self.name .. "'.\n" .. + "A runtime error occured: " .. tostring(err or "(nil)")) end end |