Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RescuedExceptionInterceptor: Handle empty configuration #2428

Merged
merged 1 commit into from
Oct 28, 2024

Conversation

MrSerth
Copy link
Contributor

@MrSerth MrSerth commented Oct 10, 2024

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

Copy link

codecov bot commented Oct 15, 2024

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 ⚠️
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%) ⬇️
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%) ⬇️

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
@solnic
Copy link
Collaborator

solnic commented Oct 28, 2024

Sorry but I'm having second thoughts about this, it's the same as I outlined here #2396 (comment)

@MrSerth
Copy link
Contributor Author

MrSerth commented Oct 28, 2024

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?

@solnic
Copy link
Collaborator

solnic commented Oct 28, 2024

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 solnic merged commit 27d7384 into getsentry:master Oct 28, 2024
137 of 139 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

NoMethodError: undefined method rails for nil
2 participants