Class: Pieces::BacktraceFormatter
- Inherits:
-
Object
- Object
- Pieces::BacktraceFormatter
- Includes:
- Configurable
- Defined in:
- lib/pieces/backtrace_formatter.rb
Instance Attribute Summary
Attributes included from Configurable
Instance Method Summary collapse
Methods included from Configurable
Instance Method Details
#format(exception) ⇒ Object
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/pieces/backtrace_formatter.rb', line 5 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 |