Sha256: 6593155f5d2bf7dd1055c0c1a91564cfa6bc9c00a91c20b016c54b97dc5e3b51

Contents?: true

Size: 761 Bytes

Versions: 83

Compression:

Stored size: 761 Bytes

Contents

require 'r10k/errors'

module R10K
  module Errors
    module Formatting
      module_function

      # Format this exception for displaying to the user
      #
      # @param exc [Exception] The exception to format
      # @param with_backtrace [true, false] Whether the backtrace should be
      #   included with this exception
      # @return [String]
      def format_exception(exc, with_backtrace = false)
        lines = []
        lines << exc.message
        if with_backtrace
          lines.concat(exc.backtrace)
        end
        if exc.respond_to?(:original) && exc.original
          lines << "Original exception:"
          lines<< format_exception(exc.original, with_backtrace)
        end
        lines.join("\n")
      end
    end
  end
end

Version data entries

83 entries across 83 versions & 2 rubygems

Version Path
r10k-5.0.0 lib/r10k/errors/formatting.rb
r10k-4.1.0 lib/r10k/errors/formatting.rb
r10k-4.0.2 lib/r10k/errors/formatting.rb
r10k-4.0.1 lib/r10k/errors/formatting.rb
r10k-4.0.0 lib/r10k/errors/formatting.rb
r10k-4.0.0.pre lib/r10k/errors/formatting.rb
r10k-3.16.0 lib/r10k/errors/formatting.rb
r10k-3.15.4 lib/r10k/errors/formatting.rb
r10k-3.15.3 lib/r10k/errors/formatting.rb
r10k-3.15.2 lib/r10k/errors/formatting.rb
r10k-3.15.1 lib/r10k/errors/formatting.rb
r10k-3.15.0 lib/r10k/errors/formatting.rb
akerl-r10k-3.14.2.1 lib/r10k/errors/formatting.rb
r10k-3.14.2 lib/r10k/errors/formatting.rb
r10k-3.14.1 lib/r10k/errors/formatting.rb
r10k-3.14.0 lib/r10k/errors/formatting.rb
r10k-3.13.0 lib/r10k/errors/formatting.rb
r10k-3.12.1 lib/r10k/errors/formatting.rb
r10k-3.12.0 lib/r10k/errors/formatting.rb
r10k-3.11.0 lib/r10k/errors/formatting.rb