Skip to content

Commit

Permalink
Include person/request scope when enable_rails_error_subscriber is en…
Browse files Browse the repository at this point in the history
…abled
  • Loading branch information
AlphonseSantoro committed Oct 18, 2024
1 parent c4edf7e commit c2dca56
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions lib/rollbar/plugins/rails/error_subscriber.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,16 @@ def report(error, handled:, severity:, context:, source: nil)
# The default `nil` for capture_uncaught means `true`. so check for false.
return unless handled || Rollbar.configuration.capture_uncaught != false

extra = context.is_a?(Hash) ? context.deep_dup : {}
extra[:custom_data_method_context] = source
Rollbar.log(severity, error, extra)
controller = context[:controller]
scope = {
person: controller.rollbar_person_data,
request: controller.rollbar_request_data
}
Rollbar.scoped(scope) do
extra = context.is_a?(Hash) ? context.deep_dup : {}
extra[:custom_data_method_context] = source
Rollbar.log(severity, error, extra)
end
end
end
end

0 comments on commit c2dca56

Please sign in to comment.