Many things: switch from hacky multi-arg xpcall implementations to a standard util.xpcall

This commit is contained in:
Matthew Wild 2018-10-26 19:32:00 +01:00
parent 1454ac8208
commit f5f6460b2e
7 changed files with 23 additions and 31 deletions

View file

@ -20,8 +20,9 @@ local ssl_available = pcall(require, "ssl");
local t_insert, t_concat = table.insert, table.concat;
local pairs = pairs;
local tonumber, tostring, xpcall, traceback =
tonumber, tostring, xpcall, debug.traceback;
local tonumber, tostring, traceback =
tonumber, tostring, debug.traceback;
local xpcall = require "util.xpcall".xpcall;
local error = error
local setmetatable = setmetatable;
@ -101,7 +102,7 @@ function listener.onconnect(conn)
end
log("debug", "Request '%s': Calling callback, status %s", req.id, code or "---");
return log_if_failed(req.id, xpcall(function () return callback(content, code, response, request) end, handleerr));
return log_if_failed(req.id, xpcall(callback, handleerr, content, code, response, request));
end
req.reader = request_reader;
req.state = "status";