Sha256: 4abaf0678df7e7b7a0a265071c97050415ff0d9fa7c3c4a850e2a286954f0ea0

Contents?: true

Size: 1.01 KB

Versions: 1

Compression:

Stored size: 1.01 KB

Contents

# this one display full BT with code, at the end [no performance loss]

require File.dirname(__FILE__) + "/shared"
require 'sane'

at_exit {
  if $! && !$!.is_a?(SystemExit) # SystemExit's are just normal, not exceptional
    puts "\n     " + $!.inspect + ' ' + $!.to_s
    bt2 = $!.backtrace
    backtrace_with_code = $!.backtrace.map{ |bt_line|
      if OS.windows? && bt_line[1..1] == ':'
        #["C", "/dev/ruby/allgems/lib/allgems/GemWorker.rb", "91", "in `unpack'"]      
        drive, file, line, junk = bt_line.split(":")
        file = drive + ":" + file
      else
        file, line, junk = bt_line.split(":")
      end
      line = line.to_i
#      line -= 1 unless line == 0 # not sure if needed
      actual_line = Tracer.get_line(file, line)
      "#{bt_line}\n\t#{actual_line.strip if actual_line}"
    }
    puts backtrace_with_code
#    puts "===="
  else
    puts "(no exception found to backtrace)" if $VERBOSE
  end
  # exit! TODO I guess do this once ours isn't *so* ugly
  # TODO compare with that fella xray
}

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
backtracer-0.4.1 lib/backtracer.rb