From: merch-redmine@... Date: 2019-07-12T03:43:43+00:00 Subject: [ruby-core:93705] [Ruby master Bug#9358] TracePoint's raise event should throw 'not supported by this event (RuntimeError)' on calling return_value Issue #9358 has been updated by jeremyevans0 (Jeremy Evans). Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN, 2.1: UNKNOWN) Status changed from Open to Closed This is expected behavior. As the documentation states: `raised_exception`: `Value from exception raised on the :raise event` `return_value`: `Return value from :return, c_return, and b_return event` You cannot call methods not supported by the type. You can use the `event` method to check the type of the particular event. ---------------------------------------- Bug #9358: TracePoint's raise event should throw 'not supported by this event (RuntimeError)' on calling return_value https://bugs.ruby-lang.org/issues/9358#change-79329 * Author: andhapp (Anuj Dutta) * Status: Closed * Priority: Normal * Assignee: * Target version: * ruby -v: 2.1.0 * Backport: ---------------------------------------- =begin Hello, In TracePoint class, if a particular introspection method is not supported then 'not supported by this event (RuntimeError)' is thrown. === Line event doesn't support raised_exception TracePoint.trace(:line) do |tp| p tp.raised_exception end #=> RuntimeError: 'raised_exception' not supported by this event However, that doesn't seem to happen for 'raise' event. The call to return_value stops the trace altogether. Here's the code to reproduce it: === Code class Car def self.start begin raise StandardError.new, 'Error!' rescue end end end TracePoint.trace(:raise) do |tp| p tp.raised_exception p [tp.return_value, tp.raised_exception] end Car.start === Expected Output #=> # #=> `return_value': not supported by this event (RuntimeError) === Actual Output #=> # Is this expected behaviour? Thanks =end -- https://bugs.ruby-lang.org/ Unsubscribe: