Bruno Jouhier (2013-06-15T09:18:20.000Z)
github at esdiscuss.org (2013-07-12T02:27:38.076Z)
Yes, that's the problem. My library is keeping a stack of suspended generators that corresponds to the stack of "await" calls. When an exception occurs I rethrow it into the suspended generators until it gets caught (see the run function in https://github.com/bjouhier/galaxy/blob/master/lib/galaxy.js). This works fine and the exception propagates through the stack of "await" calls exactly as you would expect it to (I have a series of unit tests that check all sorts of try/catch/finally combinations and they work). So the _propagation_ of exceptions through a stack of await calls works fine. What I am lacking is a way to reconstruct the stack trace of await calls when an exception is caught. As the exception goes through my little run function when it bubbles up I could easily collect the stack frames of the suspended generators into the exception object. The only thing that's missing is an API to get stack frame information from a suspended generator. My objective is not too much to get this await stack trace in the debugger, it is to be able to log it when the application is run without a debugger. A generator object represents a computation which has been suspended. We have an API to resume this computation (next/throw). What's missing is an API to get information about this suspended computation (which function, where in the source).