From: Martin Boese Date: 2010-02-11T16:46:31+09:00 Subject: Re: Global rescue - DRY (don't repeat yourself) On Thu, 11 Feb 2010 16:27:02 +0900 Jan Roslind wrote: > Raveendran .P wrote: > > .... > > begin > > puts fdg > > rescue > > Library.error > > end > > ..... > > Sorry, but I ends up adding > > rescue > Library.error binding, self > > to every methods. Not wery DRY. Problem if I want to change rescue > clause later (add a argument) > > Regards > Jan Hmm.. what about: class Code def self.try(&block) begin block.call rescue puts "Errors: #{$!}" end end end Code.try do a = 1123 bad_code end Cheers, Martin