You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: exception_cause_chain.rb
    path of file: ./repos/sentry-ruby/sentry-raven/lib/raven/utils
    
    the code of the file until where you have to start completion: module Raven
  module Utils
    module ExceptionCauseChain
      def self.exception_to_array(exception)
        if exception.respond_to?(:cause) && exception.cause
        
    
      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