-
-
Notifications
You must be signed in to change notification settings - Fork 531
Description
Issue Description
The built-in Sentry::Rails::ErrorSubscriber receives the handled: parameter from Rails.error.report() but never passes it through to the Sentry mechanism. All errors end up as handled: false regardless of how they were reported.
The root cause is in Integrable#capture_exception (line 19):
hint[:mechanism] ||= Sentry::Mechanism.new(type: integration_name, handled: false)Since the ErrorSubscriber never sets hint[:mechanism], the ||= always kicks in with handled: false.
Suggested Fix
In Sentry::Rails::ErrorSubscriber#report, set the mechanism before calling capture_exception:
hint[:mechanism] = Sentry::Mechanism.new(type: Sentry::Rails.integration_name, handled: handled)Reproduction Steps
Report a handled warning
Rails.error.report(
StandardError.new("handled warning"),
handled: true,
severity: :warning
)Check the resulting event in Sentry, the handled tag will show no.
Expected Behavior
The event should have handled: yes since handled: true was passed to Rails.error.report()
Actual Behavior
The event always has handled: no because Integrable#capture_exception defaults the mechanism to handled: false and the subscriber never overrides it.
Ruby Version
3.2.6
SDK Version
6.3.1
Integration and Its Version
sentry-rails 6.3.1
Sentry Config
Sentry.init do |config|
config.dsn = "..."
config.rails.register_error_subscriber = true # default
endMetadata
Metadata
Assignees
Projects
Status