RescuedExceptionInterceptor: Handle empty configuration
Previously, it could happen that Sentry.configuration was nil. In this case, calling rails would produce a NoMethodError. We fix this issue by using safe navigation.
Furthermore, this commit ensures we use a reasonable default in case the configuration couldn't be loaded. Since the config report_rescued_exceptions defaults to true, we assume this value here, too.
Fixes #2386
Codecov Report
Attention: Patch coverage is 66.66667% with 1 line in your changes missing coverage. Please review.
Project coverage is 98.15%. Comparing base (
9bba2ef) to head (226ff07). Report is 2 commits behind head on master.
| Files with missing lines | Patch % | Lines |
|---|---|---|
| .../lib/sentry/rails/rescued_exception_interceptor.rb | 66.66% | 1 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## master #2428 +/- ##
==========================================
- Coverage 98.18% 98.15% -0.03%
==========================================
Files 126 126
Lines 4726 4728 +2
==========================================
+ Hits 4640 4641 +1
- Misses 86 87 +1
| Components | Coverage Δ | |
|---|---|---|
| sentry-ruby | 98.51% <ø> (ø) |
|
| sentry-rails | 97.05% <66.66%> (-0.15%) |
:arrow_down: |
| sentry-sidekiq | 97.47% <ø> (ø) |
|
| sentry-resque | 92.85% <ø> (ø) |
|
| sentry-delayed_job | 95.65% <ø> (ø) |
|
| sentry-opentelemetry | 99.31% <ø> (ø) |
| Files with missing lines | Coverage Δ | |
|---|---|---|
| .../lib/sentry/rails/rescued_exception_interceptor.rb | 93.75% <66.66%> (-6.25%) |
:arrow_down: |
Sorry but I'm having second thoughts about this, it's the same as I outlined here https://github.com/getsentry/sentry-ruby/pull/2396#issuecomment-2440715857
I've had a quick look at the two test failures. The second one is caused by Docker Pull Limits, the first one failed when setting up Ruby 2.5. Both don't look related, I'd say. How can we proceed here?
I've had a quick look at the two test failures. The second one is caused by Docker Pull Limits, the first one failed when setting up Ruby 2.5. Both don't look related, I'd say. How can we proceed here?
I handled those failures. We should be good to merge this.