getsentry / getsentry/sentry-ruby

Opaque with_scope behaviour with exceptions in block

オープン
#1,855 コメント 9 件 リアクション 2 件 担当者 1 名 @sl0thentr0py が担当を希望しています GitHub で見る
Discussion Errors Improvement Question Ruby sentry-ruby
主要言語
Ruby
スター
987
フォーク
541
平均マージ
17時間 40分
マージ済み PR(30日)
19

説明

Creating this issue for further discussion.

If you do the following, the exception will be captured but the tag won't be used (because that scope is thrown away in [an ensure](https://github.com/getsentry/sentry-ruby/blob/332315907185e6ffe05aa64dc751cdd8ab9f5448/sentry-ruby/lib/sentry/hub.rb#L60-L61)).
```ruby
Sentry.with_scope do |scope|
scope.set_tags(my_tag: "my value")
1 / 0
end
```

If you do the following, the exception will be captured _and_ the tag will be visible.
```ruby
Sentry.with_scope do |scope|
scope.set_tags(my_tag: "my value")

begin
1 / 0
rescue => e
Sentry.capture_exception(e)
end
end
```

_Originally posted by @sl0thentr0py in https://github.com/getsentry/sentry-docs/pull/5328#issuecomment-1194148134_

コントリビューションガイド

コントリビューションガイドを開く

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。