Author: kkaempf Date: Tue Jul 17 17:53:28 2007 New Revision: 39477 URL: http://svn.opensuse.org/viewcvs/yast?rev=39477&view=rev Log: count line numbers and show them on exceptions Modified: trunk/yxmlconv/src/listener.rb Modified: trunk/yxmlconv/src/listener.rb URL: http://svn.opensuse.org/viewcvs/yast/trunk/yxmlconv/src/listener.rb?rev=39477&r1=39476&r2=39477&view=diff ============================================================================== --- trunk/yxmlconv/src/listener.rb (original) +++ trunk/yxmlconv/src/listener.rb Tue Jul 17 17:53:28 2007 @@ -25,8 +25,6 @@ # # -$LOAD_PATH << File.dirname(__FILE__) # find all other files in same dir - require 'rexml/document' require 'output' require 'helper' @@ -48,6 +46,7 @@ @state = :undef @listener = nil $output = Output.new( output, flags ) + $lnum = 1 end def xmldecl( version, encoding, standalone ) @@ -55,14 +54,20 @@ end def text( s ) + $lnum += s.count( "\n" ) s.strip! - return if s.empty? + return if s.empty? return @listener.text( s ) if @listener end def tag_start( name, attrs ) debug "++ #{self.class}.tag_start(#{name}) @listener #{@listener}" - return @listener.tag_start( name, attrs ) if @listener + begin + return @listener.tag_start( name, attrs ) if @listener + rescue Exception => e + STDERR.puts "In line #{$lnum}: " + e + raise e + end out = nil case name when "ycp" @@ -90,4 +95,3 @@ end end - -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org