raise and rescue



Is is possible to raise an exception then rescue it and then go back to
whereever it was raised and continue with execution?
For example,
class Test
end

begin
code line 1
code line 2
code line 3
code line 4
code line 5
raise Class.new
code line 7
code line 8
code line 9

rescue Class
#here in some cases send back execution to code line 7

ensure
end



Thanks.
--
Posted via http://www.ruby-forum.com/.

.



Relevant Pages

  • Re: raise and rescue
    ... You _might_ be able to achieve something like that with an in-line rescue ... raise Class.new rescue some_method_to_cope ... wherever it was raised and continue with execution? ... Daniel Brumbaugh Keeney ...
    (comp.lang.ruby)
  • Re: problems with rescue clause.
    ... raise RuntimeError, "#failed" ... Also, you don't really need two identical rescue clauses at the top, ... Personally, I would prevent try_imap from ever raising an exception, ...
    (comp.lang.ruby)
  • Re: raise and rescue
    ... Robert Klemme wrote: ... whereever it was raised and continue with execution? ... irb:003:1* puts 1 ...
    (comp.lang.ruby)
  • Re: Riddle me this (a question about expressions)
    ... saying that the 'raise .. ... is an rvalue in the assigment. ... The genesis of this thread was why the ruby compiler disallows: ... x = raise rescue 1 ...
    (comp.lang.ruby)
  • Re: Rescue on do end blocks
    ... puts "Error" ... and those are used to compose blocks. ...
    (comp.lang.ruby)

Loading