Sha256: 5f3a16480073006e20c1924b2d418a733354d14f154760e23050ca4d36e56af6

Contents?: true

Size: 526 Bytes

Versions: 4

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

module Cornucopia
  module Util
    class MultipleExceptionFormatter
      def self.format_backtrace(value)
        return value.to_s unless value.is_a?(Array) && value.all? { |val| val.is_a?(Exception) }
        value_text = value.each_with_object([]) do |error, array|
          array << "Exception \##{array.length + 1}\n#{error.message}\n#{error.backtrace.join("\n  ")}"
        end.join("\n\n")

        Cornucopia::Util::ReportBuilder.pretty_format(value_text)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
cornucopia-0.2.0 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.56 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.55 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.54 lib/cornucopia/util/multiple_exception_formatter.rb