yermej
4/2/2008 11:58:00 PM
On Apr 2, 6:27 pm, Iñaki Baz Castillo <i...@aliax.net> wrote:
> Hi, in the code below I want "retry/break/XXXXX" (undefined) in SECOND BEGIN
> to go back to FIRST BEGIN when "raise" instead of SECOND BEGIN but it goes to
> SECOND BEGIN.
>
> I think it's the expected behaviour but maybe there is a way to get what I
> want, is it possible?
Can you combine the two?
> class MyTcpServer < GServer
>
> def serve(io)
>
> loop do
> begin # FIRST BEGIN
> puts "welcome"
> ...
> ...
> raise
> ...
> ...
> rescue NameError # or whatever class of error you want to catch
> $stderr.print "serve(io) ERROR: " + $!
rescue # most other stuff
> puts "ERROR"
> retry/break/return/XXXXX # Restart from FIRST > end
> end # loop do
>
> end # def serve(io)
> ------------------------------------------------------------
>
> Thanks a lot.
>
> --
> Iñaki Baz Castillo