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

Add Sentry.with_exception_captured helper #1814

Merged
merged 3 commits into from
May 20, 2022

Conversation

st0012
Copy link
Collaborator

@st0012 st0012 commented May 8, 2022

This PR adds the Sentry.with_exception_captured helper to simplify exception rescuing/reporting logic:

Sentry.with_exception_captured do
 1/1 #=> 1 will be returned
end

Sentry.with_exception_captured do
 1/0 #=> ZeroDivisionError will be reported and re-raised
end

It's the same as:

begin
  my_code
rescue Exception => e
  Sentry.caputre_exception(e)
  raise
end

@st0012 st0012 added this to the 5.4.0 milestone May 8, 2022
@st0012 st0012 self-assigned this May 8, 2022
@st0012 st0012 added this to In progress in 5.x via automation May 8, 2022
@codecov-commenter
Copy link

codecov-commenter commented May 8, 2022

Codecov Report

Merging #1814 (2ea8d21) into master (daeb133) will increase coverage by 0.01%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master    #1814      +/-   ##
==========================================
+ Coverage   98.45%   98.46%   +0.01%     
==========================================
  Files         145      145              
  Lines        8661     8675      +14     
==========================================
+ Hits         8527     8542      +15     
+ Misses        134      133       -1     
Impacted Files Coverage Δ
sentry-ruby/lib/sentry-ruby.rb 96.29% <100.00%> (+0.09%) ⬆️
sentry-ruby/spec/sentry_spec.rb 99.77% <100.00%> (+<0.01%) ⬆️
sentry-ruby/lib/sentry/breadcrumb.rb 100.00% <0.00%> (+3.70%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update daeb133...2ea8d21. Read the comment docs.

@st0012 st0012 requested a review from sl0thentr0py May 8, 2022 21:13
@st0012 st0012 force-pushed the add-with_exception_captured-helper branch from 50a7ef0 to 566e548 Compare May 8, 2022 21:38
@st0012 st0012 merged commit d95e30b into master May 20, 2022
5.x automation moved this from In progress to Done May 20, 2022
@st0012 st0012 deleted the add-with_exception_captured-helper branch May 20, 2022 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
5.x
Done
Development

Successfully merging this pull request may close these issues.

None yet

3 participants