class ActiveSupport::ErrorReporter

def report(error, handled:, severity: handled ? :warning : :error, context: {})

Rails.error.report(error, handled: true)

When the block based +handle+ and +record+ methods are not suitable, you can directly use +report+
def report(error, handled:, severity: handled ? :warning : :error, context: {})
  unless SEVERITIES.include?(severity)
    raise ArgumentError, "severity must be one of #{SEVERITIES.map(&:inspect).join(", ")}, got: #{severity.inspect}"
  end
  full_context = ActiveSupport::ExecutionContext.to_h.merge(context)
  @subscribers.each do |subscriber|
    subscriber.report(error, handled: handled, severity: severity, context: full_context)
  rescue => subscriber_error
    if logger
      logger.fatal(
        "Error subscriber raised an error: #{subscriber_error.message} (#{subscriber_error.class})\n" +
        subscriber_error.backtrace.join("\n")
      )
    else
      raise
    end
  end
  nil
end