summaryrefslogtreecommitdiffhomepage
path: root/libs/web/luasrc/dispatcher.lua
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2009-02-26 16:45:01 +0000
committerSteven Barth <steven@midlink.org>2009-02-26 16:45:01 +0000
commit3b7bb9c82fa2b02a8200fd2c77c5539081180086 (patch)
tree085a787e8fe0e06acf28d3e3ef216c563a517dac /libs/web/luasrc/dispatcher.lua
parent2b0c0485e8dcbd48437204edd732005e49339009 (diff)
Enable stack tracebacks for 500 errors
Diffstat (limited to 'libs/web/luasrc/dispatcher.lua')
-rw-r--r--libs/web/luasrc/dispatcher.lua9
1 files changed, 4 insertions, 5 deletions
diff --git a/libs/web/luasrc/dispatcher.lua b/libs/web/luasrc/dispatcher.lua
index 538017dc75..6914ffb43e 100644
--- a/libs/web/luasrc/dispatcher.lua
+++ b/libs/web/luasrc/dispatcher.lua
@@ -66,6 +66,7 @@ function error404(message)
if not luci.util.copcall(luci.template.render, "error404") then
luci.http.prepare_content("text/plain")
luci.http.write(message)
+ luci.util.perror(message)
end
return false
end
@@ -113,11 +114,9 @@ function httpdispatch(request)
table.insert(context.request, node)
end
- local stat, err = util.copcall(dispatch, context.request)
- if not stat then
- luci.util.perror(err)
- error500(err)
- end
+ local stat, err = util.coxpcall(function()
+ dispatch(context.request)
+ end, error500)
luci.http.close()