exception handling in ruby

J

Junkone

HI
My exception handling routine is not able to thro the stack trace etc
of the exception .
for eg.
rescue Exception
puts $_
I get a nil in $_

However when i dont handle the exception, i get the nice exception
message
Watir::Exception::UnknownObjectException: Unable to locate object,
using id and

How do i capture the exception details?
Regards

Seede
 
J

Jan Svitok

HI
My exception handling routine is not able to thro the stack trace etc
of the exception .
for eg.
rescue Exception
puts $_
I get a nil in $_

However when i dont handle the exception, i get the nice exception
message
Watir::Exception::UnknownObjectException: Unable to locate object,
using id and

How do i capture the exception details?
Regards

Seede

either use $! and $@, or write it more explicitly:

...
rescue Exception ex
puts ex.mesage
puts ex.backtrace.join("\n")
end
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,699
Latest member
AnneRosen

Latest Threads

Top