Project

General

Profile

Actions

Feature #18659

open

Create a Binding at the time of an exception and make it available to Rescue

Added by pedz (Perry Smith) over 2 years ago. Updated over 2 years ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:108061]

Description

When an exception occurs, create a binding or I assume make a reference to the current binding and then add that to the Exception class via (e.g.) a #binding method. This would allow users to have a more global rescue code but would still have access to the variables that were in scope at the time of the exception.

My particular use case is when parsing files -- especially a list of files. The outer loop is for each file. The next inner loop is for each line in the file. At the time of an exception, it would be nice to have access while in the a rescue clause to the file name, line number, current line, and other interesting variables. Adding rescue closes in the inner blocks creates a lot of redundant code.

Actions

Also available in: Atom PDF

Like0
Like0