diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-03-14 01:16:03 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-03-14 01:16:03 +0000 |
commit | fc62fe46d0bed54764afcbe05955eee40a507270 (patch) | |
tree | e9c02b86e9d1bd9654aae7f9a041b33c887dc454 /libs | |
parent | ee4852a5ad79452f2ea76e32463a0af91b857752 (diff) |
libs/web:
- improve handling of low level runtime errors
- wrap access to luci.main into assert()
Diffstat (limited to 'libs')
-rw-r--r-- | libs/web/luasrc/dispatcher.lua | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua index 062084f86..0d48acd14 100644 --- a/libs/web/luasrc/dispatcher.lua +++ b/libs/web/luasrc/dispatcher.lua @@ -77,6 +77,8 @@ function error500(message) luci.util.perror(message) if not context.template_header_sent then luci.http.status(500, "Internal Server Error") + luci.http.prepare_content("text/plain") + luci.http.write(message) else require("luci.template") if not luci.util.copcall(luci.template.render, "error500", {message=message}) then @@ -132,6 +134,9 @@ function dispatch(request) ctx.urltoken = ctx.urltoken or {} local conf = require "luci.config" + assert(conf.main, + "/etc/config/luci seems to be corrupt, unable to find section 'main'") + local lang = conf.main.lang if lang == "auto" then local aclang = http.getenv("HTTP_ACCEPT_LANGUAGE") or "" |