Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upstream merge #7

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion raven/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -377,12 +377,27 @@ end
-- end
-- return rvn:call(func, 1, 'foo', true)
function raven_mt:call(f, ...)
return self:call_ext(nil, f, ...)
end

--- Call given function and report any errors to Sentry with conf overrides.
-- @function Raven:call_ext
-- @param conf Conf overrides
-- @param f function to be called
-- @param ... function's arguments
-- @return the same as @{xpcall}
-- @usage
-- function func(a, b, c)
-- return a * b + c
-- end
-- return rvn:call_ext({}, func, 1, 'foo', true)
function raven_mt:call_ext(conf, f, ...)
-- When used with ngx_lua, connecting a tcp socket in xpcall error handler
-- will cause a "yield across C-call boundary" error. To avoid this, we
-- move all the network operations outside of the xpcall error handler.
local res = { xpcall(f, capture_error_handler, ...) }
if not res[1] then
self:send_report(res[2])
self:send_report(res[2], conf)
res[2] = res[2].message -- turn the error object back to its initial form
end

Expand Down