Peter Jones | 16 May 03:30

Re: Matz: can we have rescue/else/ensure available in all blocks?

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


Gmane