getsentry / getsentry/sentry-ruby

Implement local variable capture

Đang mở
#7 37 bình luận 8 reaction 0 người được giao Xem trên GitHub
Errors Feature Ruby
Ngôn ngữ chính
Ruby
Star
987
Fork
541
Merge trung bình
17 giờ 40 phút
Pull request đã merge (30 ngày)
19

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Đánh giá

Issue này chưa được đánh giá.

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.