Project

General

Profile

Bug #7622

Can't grab exceptions at (|c_|b_)return event hooks

Added by Koichi Sasada about 3 years ago. Updated about 3 years ago.

Status:
Closed
Priority:
Normal
Assignee:
ruby -v:
ruby 2.0.0dev (2012-12-21 trunk 38515) [i386-mswin32_100]
Backport:
2.0.0: UNKNOWN, 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN
[ruby-core:51124]

Description

The following code raise uncaught error:

test.rb:14:in block in <main>': FooError (FooError)
from test.rb:3:in
m1'
from test.rb:7:in m2'
from test.rb:19:in
block in '
from test.rb:17:in times'
from test.rb:17:in
'

But should be caught at line "rescue FooError => e".

code:

def m1
raise
end

def m2
m1
end

class FooError < Exception; end

TracePoint.trace{|tp|
p tp
raise FooError if tp.event == :return && tp.method_id == :m1
}

1.times{
begin
m2
rescue FooError => e
p e
end
}

History

#1 [ruby-core:51125] Updated by Koichi Sasada about 3 years ago

`ensure' is also ignored.

#2 [ruby-core:51131] Updated by Koichi Sasada about 3 years ago

  • Status changed from Open to Closed

r38601 may solve this issue.

Also available in: Atom PDF