Method: Rack::ShowExceptions#dump_exception

Defined in:
lib/rack/show_exceptions.rb

#dump_exception(exception) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/rack/show_exceptions.rb', line 65

def dump_exception(exception)
  if exception.respond_to?(:detailed_message)
    message = exception.detailed_message(highlight: false)
  # :nocov:
  # Ruby 3.2 added Exception#detailed_message, so the else
  # branch cannot be hit on the current Ruby version.
  else
    message = exception.message
  # :nocov:
  end
  string = "#{exception.class}: #{message}\n".dup
  string << exception.backtrace.map { |l| "\t#{l}" }.join("\n")
  string
end