Module: Telebugs::Backtrace

Defined in:
lib/telebugs/backtrace.rb

Overview

Represents a cross-Ruby backtrace from exceptions (including JRuby Java exceptions). Provides information about stack frames (such as line number, file and method) in convenient for Telebugs format.

Defined Under Namespace

Modules: Patterns

Class Method Summary collapse

Class Method Details

.java_exception?(error) ⇒ Boolean

Checks whether the given exception was generated by JRuby’s VM.

Returns:

  • (Boolean)


87
88
89
90
91
92
93
94
95
96
# File 'lib/telebugs/backtrace.rb', line 87

def self.java_exception?(error)
  if defined?(Java::JavaLang::Throwable) &&
      error.is_a?(Java::JavaLang::Throwable)
    return true
  end

  return false unless error.respond_to?(:backtrace)

  (Patterns::JAVA =~ error.backtrace.first) != nil
end

.parse(error) ⇒ Object



80
81
82
83
84
# File 'lib/telebugs/backtrace.rb', line 80

def self.parse(error)
  return [] if error.backtrace.nil? || error.backtrace.none?

  parse_backtrace(error)
end