16 May 03:30
Re: Matz: can we have rescue/else/ensure available in all blocks?
From: Peter Jones <dev-null <at> pmade.com>
Subject: Re: Matz: can we have rescue/else/ensure available in all blocks?
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-16 01:30:31 GMT
Subject: Re: Matz: can we have rescue/else/ensure available in all blocks?
Newsgroups: gmane.comp.lang.ruby.general
Date: 2008-05-16 01:30:31 GMT
coderrr <coderrr.contact <at> gmail.com> writes: > pages.each do |page| > begin > page.links.each do |link| > begin > process link > rescue MalformedLinkError > @bad_links << link > end > end > rescue MalformedPageError > @bad_pages << page > end > end If you write code that looks like that, maybe you should give Java a second look ;) Seriously though, you could easily restructure your code to be a bit more OO and then you wouldn't have to worry about rescuing exceptions all over the place, including several times in nested loops. -- -- Peter Jones [pjones at domain below] pmade inc. - http://pmade.com
RSS Feed