Method: Exception#formatted

Defined in:
lib/openc3/core_ext/exception.rb

#formatted(hide_runtime_error_class = false, include_backtrace = true) ⇒ String



31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/openc3/core_ext/exception.rb', line 31

def formatted(hide_runtime_error_class = false, include_backtrace = true)
  if include_backtrace and self.backtrace
    if hide_runtime_error_class and self.class == RuntimeError
      "#{self.message}\n#{self.backtrace.join("\n")}"
    else
      "#{self.class.to_s.split('::')[-1]} : #{self.message}\n#{self.backtrace.join("\n")}"
    end
  else
    if hide_runtime_error_class and self.class == RuntimeError
      "#{self.message}"
    else
      "#{self.class.to_s.split('::')[-1]} : #{self.message}"
    end
  end
end