getsentry / getsentry/sentry-ruby

Implement local variable capture

未关闭
#7 37 条评论 8 个 reaction 已指派 0 人 在 GitHub 查看
Errors Feature Ruby
主要语言
Ruby
星标
987
派生
541
平均合并
17 小时 40 分钟
30 天内合并 PR
19

描述

On 1.9.2 and 1.9.3 this can be done easily using the [binding_of_caller](https://github.com/banister/binding_of_caller) gem.

Example monkey patch:

``` ruby

require 'binding_of_caller'

module Kernel
original_raise = method(:raise)
define_method(:raise) do |*args|
begin
original_raise.call(*args)
rescue Exception => e
e.instance_variable_set(:@stack_info, binding.callers)
e.set_backtrace(e.backtrace.drop(2))
original_raise.call(e)
end
end
end
```

On 1.8.7 this could be possibly be done using the continuation tracing hack outlined in http://rubychallenger.blogspot.com/2011/07/caller-binding.html

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。