[Wtr-general] How to capture exception details
Christian Baumann
mail at chriss-baumann.de
Fri Dec 22 14:49:13 EST 2006
Hello vijav,
> Now, we are able to trap exception messages using your suggestion but is there any way to capture the line number of the code that made Watir throw an exception as it would be really helpful to see an exception note like the following:
>
> "A 'so and so' exception has occured in 'so and so' line"
>
__LINE__ is what You´re looking for.
> Also can the name of the function in which the exception was thrown, be captured? Ex. if we have written a small function called 'add_an_inventor'. If, within that function, an exception occurs, can we capture the name of the user-defined function so that our exception note would be still more elaborate as it would say,
>
> "A 'so and so' exception has occured within the 'add_an_inventor' function in the 'so and so" line "
>
There are two libraries that both can log methode execution, maybe they
can help you:
http://copland.rubyforge.org/
http://needle.rubyforge.org/
> Finally, can we make the script go to a particular line once it encounters an exception. Is there a "goto" statement in Ruby?
>
Google should help You here, it´s easy to find an answer for that on You
own. ;)
Regards,
Christian
More information about the Wtr-general
mailing list