Sha256: 1a891514a6d78f604588eaa69faac5bd883be52873822a9f04ec75676c6dde31

Contents?: true

Size: 506 Bytes

Versions: 8

Compression:

Stored size: 506 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.backtrace.join("\n")}"
        end.join("\n\n")

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
cornucopia-0.1.53 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.52 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.51 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.50 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.49 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.48 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.47 lib/cornucopia/util/multiple_exception_formatter.rb
cornucopia-0.1.46 lib/cornucopia/util/multiple_exception_formatter.rb