Skip to content

Support the new Rails standard error reporting interface #1630

@georgeclaghorn

Description

@georgeclaghorn

Rails 7.0 will add a standard interface for reporting errors to error tracking services like Sentry (rails/rails#43625).

# Report any error raised and continue execution:
Rails.error.handle do
  # ...
end

# Report and re-raise any error:
Rails.error.record do
  # ...
end

# Report an error directly:
Rails.error.report(error)

Additionally, Rails’s internal execution wrappers have been updated to report errors via Rails.error.report.

The Sentry SDK can opt in to the new interface via Rails.error.subscribe(subscriber), where subscriber is an object implementing a report method. report takes a positional exception argument and handled: and context: keyword arguments.

report(Exception, handled: Boolean, context: Hash)

Supporting the new interface will allow Sentry users to use the standard Rails.error.{handle,record,report} methods. And in the future, when the standard interface is more widely deployed, it’ll make it easier for Rails users to try and adopt Sentry.

Metadata

Metadata

Assignees

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions