You start with a begin block, placing the code you know may throw an exception. 
The rescue block lets you work with the exception gracefully. There are some 
Ruby system globals that are useful to know here for reporting purposes. The 
ensure block will execute code regardless of whether an exception occurred.

$! - The exception information message set by 'raise'.
$@ - Array of backtrace of the last exception thrown.
$stderr - The current standard error output.

begin
   myObject = Object.new( param )
   myObject.action1( param )
  ...
rescue => e
   puts "Exception occured:
   puts $@
ensure
   myObject.tearDown()
end

Hope this helps,
—›Nathan Christie
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.openqa.org/thread.jspa?threadID=5886&messageID=16494#16494
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to