D
Daniel Berger
Hi all,
Say I do something like this do the Exception class:
class Exception
alias ld_init :initialize
def initialize(*args)
old_init(*args)
do_stuff
end
def do_stuff
puts "Hello World!"
end
end
And, I want +do_stuff+ to fire off if an error is *raised* but not if it is
caught (and not re-raised). In other words, I would expect +do_stuff+ to fire
off in this example:
begin
0/0
rescue ZeroDivisionError
raise
end
But I don't want to fire off in this example:
begin
0/0
rescue ZeroDivisionError
# Do nothing
end
Is there a way I can accomplish this?
Thanks,
Dan
Say I do something like this do the Exception class:
class Exception
alias ld_init :initialize
def initialize(*args)
old_init(*args)
do_stuff
end
def do_stuff
puts "Hello World!"
end
end
And, I want +do_stuff+ to fire off if an error is *raised* but not if it is
caught (and not re-raised). In other words, I would expect +do_stuff+ to fire
off in this example:
begin
0/0
rescue ZeroDivisionError
raise
end
But I don't want to fire off in this example:
begin
0/0
rescue ZeroDivisionError
# Do nothing
end
Is there a way I can accomplish this?
Thanks,
Dan