Module: LoggerHelpers

Included in:
Logger
Defined in:
lib/runtime/logging.rb

Overview

Namespace for methods to help with implicit backtrace printing

Instance Method Summary collapse

Instance Method Details

#extract_backtrace(error, default_result = nil) ⇒ Object



70
71
72
73
74
75
76
77
78
# File 'lib/runtime/logging.rb', line 70

def extract_backtrace(error, default_result = nil)
  if error.respond_to?(:backtrace)
    error.backtrace.each { |trace| original_error(trace) unless trace.nil? }
  elsif error.respond_to?(:getStackTrace)
    error.getStackTrace().each { |trace| original_error(trace) unless trace.nil? }
  else
    default_result
  end
end

#generate_message(error_or_message, error) ⇒ Object



64
65
66
67
68
# File 'lib/runtime/logging.rb', line 64

def generate_message(error_or_message, error)
  error_message = "#{error_or_message}: #{error.class.name}"
  error_message << ": #{error.message}" if error.respond_to?(:message)
  error_message
end