Comparison

net/http.lua @ 8689:c7122fbe1600

net.http: Fix for Lua 5.2: return error from error handler (xpcall changed)
author Matthew Wild <mwild1@gmail.com>
date Sat, 24 Mar 2018 11:29:04 +0000
parent 8555:4f0f5b49bb03
child 8690:0f6623712239
comparison
equal deleted inserted replaced
8688:019b4b3dd5ad 8689:c7122fbe1600
34 local function make_id(req) return (tostring(req):match("%x+$")); end 34 local function make_id(req) return (tostring(req):match("%x+$")); end
35 35
36 local listener = { default_port = 80, default_mode = "*a" }; 36 local listener = { default_port = 80, default_mode = "*a" };
37 37
38 -- Request-related helper functions 38 -- Request-related helper functions
39 local function handleerr(err) log("error", "Traceback[http]: %s", traceback(tostring(err), 2)); end 39 local function handleerr(err) log("error", "Traceback[http]: %s", traceback(tostring(err), 2)); return err; end
40 local function log_if_failed(id, ret, ...) 40 local function log_if_failed(id, ret, ...)
41 if not ret then 41 if not ret then
42 log("error", "Request '%s': error in callback: %s", id, tostring((...))); 42 log("error", "Request '%s': error in callback: %s", id, tostring((...)));
43 end 43 end
44 return ...; 44 return ...;