[Ruby] Catching an error when using class methods

Ofer Matan ofer at stanfordalumni.org
Thu Jul 19 07:59:07 PDT 2007


I am sorry to have missed the BBQ - but I caught a summer cold/cough and
though it would be better for all concerned if I stay home....

To my question:

Is there an easy way to catch exceptions for all methods in a class? I am
wrapping another class and use its methods in many of my methods and would
like to avoid using begin/rescue in each method. I saw this thread that
covers this from 2003:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/67353 

Are there better solutions now for this ?

-Ofer




More information about the Ruby mailing list