pry/pry — Issue #423: edit-method Shouldn't Discard Work in Case of Error
Author: rue
Created: 2012-01-14 15:44:02+00:00
State: open

It'd be more user-friendly if even malformed edited method could be retained so the user can fix rather than redo work. There're two subcases:

1. Exception outside the method definition, e.g. trying to save something like

MEH = "foo".to_a # NoMethodError

def blah
…
end

2. A syntax error. This seems to just confuse Pry depending on the exact syntax.

Not quite sure what would be the best approach… perhaps holding onto the tempfile and catcing errors, offering an option to restore the invalid work rather than starting off anew?

Or am I missing some workflow that enables this?