Add missing initialized? checks to sentry-rails#1919
Conversation
16b7c39 to
bda43ec
Compare
|
Can you add a changelog entry too? Thx |
bda43ec to
f4a4490
Compare
|
I always forget the changelog :( |
|
I thought about using GH's release to automatically generate changelogs, but it doesn't fit our release flow (having changelog before releasing). |
|
@st0012 craft actually supports |
|
@sl0thentr0py Thanks for your kind words ❤️ |
|
Sorry to chime in, but the Ruby SDK changelogs are a staple at Sentry. Pls keep this 🚀 |
| module ControllerTransaction | ||
| def self.included(base) | ||
| base.prepend_before_action do |controller| | ||
| return unless Sentry.initialized? |
There was a problem hiding this comment.
This code generates a LocalJumpError: unexpected return error in my install. I'm pulling sentry-ruby from source to try and mitigate the same problem as in #1885, which shows up in our test environments. (It shows up even though we're not using guard, so the workaround from that issue didn't work for us)
I'm using Rails 6.1.6 with Ruby 2.7.6p219
Instead, using a basic conditional like this was enough to make our tests pass:
if Sentry.initialized?
Sentry.get_current_scope.set_transaction_name("#{controller.class}##{controller.action_name}", source: :view)
endbug introduced in #1919 see #1919 (comment)
The
at_exitSentry.closecall might cause theseSentry.get_current_scopes to return nil and break some setups.Fixes #1885