X-Git-Url: http://git.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=src%2Fffluci%2Fdispatcher.lua;h=ee836043d2678bce05eaf053e310d46e5f59890f;hp=f3a62bb193f6b1ad6206dbdad9a2703a037a3b6b;hb=ef01ff75db17f23a90757cf473778cfefe1ad120;hpb=93c55f3c5d7d253423c9d5695b8d71388bd21988 diff --git a/src/ffluci/dispatcher.lua b/src/ffluci/dispatcher.lua index f3a62bb193..ee836043d2 100644 --- a/src/ffluci/dispatcher.lua +++ b/src/ffluci/dispatcher.lua @@ -116,7 +116,7 @@ end function error500(message) ffluci.http.status(500, "Internal Server Error") - if not pcall(ffluci.template.render, "error500") then + if not pcall(ffluci.template.render, "error500", {message=message}) then ffluci.http.textheader() print(message) end @@ -171,8 +171,13 @@ function cbi(request) i18n.loadc(request.module) - stat, map = pcall(cbi.load, path) + local stat, map = pcall(cbi.load, path) if stat then + local stat, err = pcall(map.parse, map) + if not stat then + disp.error500(err) + return + end tmpl.render("cbi/header") map:render() tmpl.render("cbi/footer") @@ -202,8 +207,13 @@ function dynamic(request) return end - stat, map = pcall(cbi.load, path) + local stat, map = pcall(cbi.load, path) if stat then + local stat, err = pcall(map.parse, map) + if not stat then + disp.error500(err) + return + end tmpl.render("cbi/header") map:render() tmpl.render("cbi/footer")