Diff

net/http.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 5488:0880a079d830
child 5714:520671c3159c
line wrap: on
line diff
--- a/net/http.lua	Mon Apr 22 12:25:00 2013 +0100
+++ b/net/http.lua	Mon Apr 22 12:35:52 2013 +0100
@@ -17,9 +17,9 @@
 local server = require "net.server"
 
 local t_insert, t_concat = table.insert, table.concat;
-local pairs, ipairs = pairs, ipairs;
-local tonumber, tostring, xpcall, select, debug_traceback, char, format =
-      tonumber, tostring, xpcall, select, debug.traceback, string.char, string.format;
+local pairs = pairs;
+local tonumber, tostring, xpcall, select, traceback =
+      tonumber, tostring, xpcall, select, debug.traceback;
 
 local log = require "util.logger".init("http");
 
@@ -101,7 +101,7 @@
 	request.parser:feed(data);
 end
 
-local function handleerr(err) log("error", "Traceback[http]: %s: %s", tostring(err), debug_traceback()); end
+local function handleerr(err) log("error", "Traceback[http]: %s", traceback(tostring(err), 2)); end
 function request(u, ex, callback)
 	local req = url.parse(u);