getsentry / getsentry/sentry-ruby

Implement local variable capture

オープン
#7 コメント 37 件 リアクション 8 件 担当者 0 名 GitHub で見る
Errors Feature Ruby
主要言語
Ruby
スター
987
フォーク
541
平均マージ
17時間 40分
マージ済み PR(30日)
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 を短くまとめたダイジェスト。