Does having a rescue clause for catch sound like a good idea to anyone?
You could write this:
catch (:error) {
# Do stuff
do_stuff() # throws :error
do_more_stuff() # throws :error
finish_stuff() # throws :error
rescue
# Oops, stuff failed, clean it
cleanup_stuff()
end
do_junk_whether_stuff_failed_or_not()
instead of this
catch(:done) {
catch (:error) {
# Do stuff
do_stuff() # throws :error
do_more_stuff() # throws :error
finish_stuff() # throws :error
throw :done
}
# Oops, error, clean up
cleanup_stuff()
}
do_junk_whether_stuff_failed_or_not()
Just wondering.
···
Jim Hranicky, Senior SysAdmin UF/CISE Department |
E314D CSE Building Phone (352) 392-1499 |
jfh@cise.ufl.edu http://www.cise.ufl.edu/~jfh |
“Given a choice between a complex, difficult-to-understand, disconcerting
explanation and a simplistic, comforting one, many prefer simplistic
comfort if it’s remotely plausible, especially if it involves blaming
someone else for their problems.”
– Bob Lewis, Infoworld