Steps to reproduce
Some error reporting services, including Sentry, allow capturing not only exceptions but also string messages. Recently, support for this functionality was added on Sentry's side, and everything worked fine with Rails version 7.2.
Unfortunately, Rails 8 introduced changes that now require error-like objects to respond (at minimum) to #cause and #backtrace.
This is kind of expected since AFAIK it was never stated that ErrorReporter should work with strings, but I'm curious if we could enhance it to support this use-case?
Expected behavior
Rails.error
=> #<ActiveSupport::ErrorReporter:0x000078f59cf4b478 @subscribers=[#<Sentry::Rails::ErrorSubscriber:0x000078f594637768>], @logger=nil, @debug_mode=true>
Rails.error.report("Some message")
=> nil # works fine on 7.2
Actual behavior
> Rails.error.report("Some message") rescue $!
=> #<NoMethodError: undefined method `backtrace' for an instance of String>
System configuration
Rails version: 8.0.1
Ruby version: 3.3.6
Steps to reproduce
Some error reporting services, including Sentry, allow capturing not only exceptions but also string messages. Recently, support for this functionality was added on Sentry's side, and everything worked fine with Rails version 7.2.
Unfortunately, Rails 8 introduced changes that now require error-like objects to respond (at minimum) to
#causeand#backtrace.This is kind of expected since AFAIK it was never stated that
ErrorReportershould work with strings, but I'm curious if we could enhance it to support this use-case?Expected behavior
Actual behavior
System configuration
Rails version: 8.0.1
Ruby version: 3.3.6