torchbear.response = nil
local request = ctx.msg
xpcall(function ()
local response = torchbear.handler(ctx.msg)
if response then
torchbear.response = response
end
end, function (msg)
msg = tostring(msg)
local trace = debug.traceback(msg, 3)
_log.error(trace)
torchbear.response = {
status = 500,
body = trace
}
end)
return torchbear.response