sentry-ruby icon indicating copy to clipboard operation
sentry-ruby copied to clipboard

RescuedExceptionInterceptor: Handle empty configuration

Open MrSerth opened this issue 1 year ago • 1 comments

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

MrSerth avatar Oct 10 '24 21:10 MrSerth

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:

codecov[bot] avatar Oct 15 '24 09:10 codecov[bot]

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

solnic avatar Oct 28 '24 07:10 solnic

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?

MrSerth avatar Oct 28 '24 16:10 MrSerth

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.

solnic avatar Oct 28 '24 18:10 solnic