Skip to content

Capture Rails runner's exceptions before exiting#1820

Merged
st0012 merged 3 commits intomasterfrom
implement-#1789
May 20, 2022
Merged

Capture Rails runner's exceptions before exiting#1820
st0012 merged 3 commits intomasterfrom
implement-#1789

Conversation

@st0012
Copy link
Copy Markdown
Contributor

@st0012 st0012 commented May 15, 2022

Rails currently doesn't provide any callback for capturing Rails runner's exceptions, so we need to use at_exit for it. But it should be supported in 7.1 (PR: rails/rails#44999) via the enhanced error reporter integration.

And because it's very complicated, if not impossible, to monitor if a Rails runner process reports to Sentry, so I didn't add any test for it. I used this for testing instead:

bundle exec rails runner "1/0" # should be reported
bundle exec rails runner "1/1" # doesn't do anything

Implements and closes #1789

@st0012 st0012 added this to the 5.4.0 milestone May 15, 2022
@st0012 st0012 requested a review from sl0thentr0py May 15, 2022 09:13
@st0012 st0012 self-assigned this May 15, 2022
@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 15, 2022

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.46%. Comparing base (4ba0ca2) to head (ab8561f).
⚠️ Report is 536 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1820   +/-   ##
=======================================
  Coverage   98.46%   98.46%           
=======================================
  Files         145      145           
  Lines        8659     8661    +2     
=======================================
+ Hits         8526     8528    +2     
  Misses        133      133           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@st0012 st0012 force-pushed the implement-#1789 branch from d78113c to 2968f9d Compare May 15, 2022 09:14
@st0012 st0012 force-pushed the implement-#1789 branch from 2968f9d to ea0e5b7 Compare May 15, 2022 09:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Capture rails runner's exceptions

3 participants