# Copyright: Copyright (c) 2004 Nicolas Despres. All rights reserved. # Author: Nicolas Despres . # License: Gnu General Public License. # $LastChangedBy: polrop $ # $Id: exception.rb 195 2005-04-11 15:00:45Z polrop $ class Exception #FIXME: write a ruby_pp which print exception backtrace exactly as ruby does # by cuting long and repetitive backtrace. def long_pp str = short_pp + "\n" backtrace[1..-1].each { |x| str += " from #{x}\n" } str.chomp end def short_pp exc_name = inspect.sub(/^#<(\w+):.+$/, '\1') if backtrace.nil? "#{self} (#{exc_name})" else "#{backtrace[0]}: #{self} (#{exc_name})" end end end # class Exception