123456789_123456789_123456789_123456789_123456789_

Module: ActiveSupport::Notifications::FanoutIteration

Do not use. This module is for internal use only.

Instance Method Summary

Instance Method Details

#iterate_guarding_exceptions(collection) (private)

[ GitHub ]

  
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 22

def iterate_guarding_exceptions(collection)
  exceptions = nil

  collection.each do |s|
    yield s
  rescue Exception => e
    exceptions ||= []
    exceptions << e
  end

  if exceptions
    exceptions = exceptions.flat_map do |exception|
      exception.is_a?(InstrumentationSubscriberError) ? exception.exceptions : [exception]
    end
    if exceptions.size == 1
      raise exceptions.first
    else
      raise InstrumentationSubscriberError.new(exceptions), cause: exceptions.first
    end
  end

  collection
end