Software /
code /
prosody
Diff
net/http/server.lua @ 5505:0b6a99e6c1b1
mod_c2s, mod_s2s, net.http, net.http.server: Improve tracebacks (omit traceback function), to make it clearer where an error occured
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 22 Apr 2013 12:35:52 +0100 |
parent | 5504:b760b5f0c2b0 |
child | 5754:dee0f05ccf70 |
line wrap: on
line diff
--- a/net/http/server.lua Mon Apr 22 12:25:00 2013 +0100 +++ b/net/http/server.lua Mon Apr 22 12:35:52 2013 +0100 @@ -9,7 +9,7 @@ local s_upper = string.upper; local setmetatable = setmetatable; local xpcall = xpcall; -local debug = debug; +local traceback = debug.traceback; local tostring = tostring; local codes = require "net.http.codes"; @@ -88,7 +88,7 @@ local function _handle_request() return handle_request(_1, _2, _3); end local last_err; -local function _traceback_handler(err) last_err = err; log("error", "Traceback[http]: %s: %s", tostring(err), debug.traceback()); end +local function _traceback_handler(err) last_err = err; log("error", "Traceback[httpserver]: %s", traceback(tostring(err), 2)); end events.add_handler("http-error", function (error) return "Error processing request: "..codes[error.code]..". Check your error log for more information."; end, -1);