Skip to content

Commit

Permalink
Capture Rails runner's exceptions before exiting (#1820)
Browse files Browse the repository at this point in the history
* Capture Rails runner's exceptions before exiting

* Update changelog
  • Loading branch information
st0012 committed May 20, 2022
1 parent 4ba0ca2 commit daeb133
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### Features

- Handle exception with large stacktrace without dropping entire item [#1807](https://github.com/getsentry/sentry-ruby/pull/1807)
- - Capture Rails runner's exceptions before exiting [#1820](https://github.com/getsentry/sentry-ruby/pull/1820)

### Refactoring

Expand Down
5 changes: 5 additions & 0 deletions sentry-rails/lib/sentry/rails/railtie.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ class Railtie < ::Rails::Railtie
runner do
next unless Sentry.initialized?
Sentry.configuration.background_worker_threads = 0

at_exit do
# TODO: Add a condition for Rails 7.1 to avoid confliction with https://github.com/rails/rails/pull/44999
Sentry::Rails.capture_exception($ERROR_INFO, tags: { source: "runner" }) if $ERROR_INFO
end
end

def configure_project_root
Expand Down

0 comments on commit daeb133

Please sign in to comment.