Got the answer I need from the Programming Ruby 2nd Edition book and thought
I would share it here.

From the "Handling Exceptions" section (p. 361), I got that I should add the
"rescue" block to the end of my site-walking methods, and not the calling
method (i.e. page_set_to_check()).  Basically I was using the rescue block
in a way that Ruby didn't pay attention to.

So I made the following changes to my script:
(1) delete the page_set_to_check() method
(2) added the following rescue block to the end of each page set
(site-walking) method:
----
module site_walkabout_methods
 ...
 def walk_Public_Pages
     # launch ie
     # goto some page
     # get page size and download time
     # click to another page.  yadda, yadda.
     # ...
 rescue => e
     $something_went_wrong = 'Yes'
     puts e
 ensure
     write_status
 end

end
----

So the methods themselves are self-correcting and I don't need to try and
capture exceptions with some umbrella method.  Cool.

I'm happy.  Moving on..

Cheers.  Paul C.
_______________________________________________
Wtr-general mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/wtr-general

Reply via email to