RFC: A proposal for asynchronous exception handling

At the moment, if you have an EventEmitter, and it has an unhandled exception, it terminates the node process with an error message. This makes dealing with exceptions in nested event handlers very difficult, since there’s no containing scope other than the closure created for the callback.

I propose keeping track of the ‘current’ EventEmitter in each event handler, snagging a reference to the parent event handler (which should be available on the stack at the time the EventEmitter is created), and emitting an error event on the parent EventEmitter with the exception, passing it ‘upward’, yet in an asynchronous fashion.

Comments?