-- 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" ..
+ (err or "Unknown syntax error"))
else
self.cache[name] = self.template
end
-- 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