module Raven::Utils::ExceptionCauseChain

Public Class Methods

exception_to_array(exception) click to toggle source
# File lib/raven/utils/exception_cause_chain.rb, line 4
def self.exception_to_array(exception)
  if exception.respond_to?(:cause) && exception.cause
    exceptions = [exception]
    while exception.cause
      exception = exception.cause
      break if exceptions.any? { |e| e.object_id == exception.object_id }

      exceptions << exception
    end
    exceptions
  else
    [exception]
  end
end