[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

exception handling in ruby

Junkone

8/18/2006 7:51:00 PM

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

1 Answer

Jano Svitok

8/18/2006 8:02:00 PM

0

On 8/18/06, Junkone <junkone1@gmail.com> wrote:
> 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