Sha256: cbc5dd4d51b0d56325b97cae305978f60c9a3e851151e647d11f86cedbd9d98c

Contents?: true

Size: 577 Bytes

Versions: 2

Compression:

Stored size: 577 Bytes

Contents

module Pieces
  class BacktraceFormatter
    include Configurable

    def format(exception)
      output = ["Exception<#{exception.class.name}>: #{exception.message}"]
      output << ''

      begin
        require 'rails'
        trace = ::Rails.backtrace_cleaner.clean(exception.backtrace)
      rescue LoadError => e
        trace = exception.backtrace
          # .delete_if { |line| !line.include?(config.path) }
          # .map { |line| line.sub("#{config.path}/", '') }
      end

      output.concat(trace.map { |line| "     #{line}" }).join("\n")
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pieces-0.5.1 lib/pieces/backtrace_formatter.rb
pieces-0.5.0 lib/pieces/backtrace_formatter.rb