Hello people,
Is there a way in Watir by which one can capture the line number of the code
that threw an exception? We can get the actual message in the exception from
the gloabl variable '$!'. Can we get the code's line number, which caused this
exception, from some other global variable?
For example, the following code:
begin
print z
rescue
puts "The exception message was " + $!.to_s
end
would output the message,
'The exception message was undefined local variable or method `z' for
#<Object:0x2ac9258>'.
But without the 'begin -- rescue class;, the code would have printed the error
message,
'file_name.rb:117 (or some other line number): undefined local variable or
method `z' for #<Object:0x2ac9258> (NameError)
I want to use the 'begin -- rescue class' and still get the exact line number
along with the error message. Is that possible?
Thanks for your time,
Vijay.
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=6777&messageID=19510#19510
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general