Consider:

try {
    doStuff();
} catch (e) {
    console.log("uh oh, got an e", e);
    throw e;
}

In Node and in all browsers I've tested with, this currently loses the stack 
trace for `e`, and more importantly loses debugger step-back-ability in tools 
like Firebug and Web Inspector.

One solution would be to hope V8 and the browser vendors simply don't throw 
away this stack trace, like they do currently. This seems like a win to me, but 
the fact that it hasn't happened implies there must be something wrong with the 
idea, e.g. maybe it breaks down in less-than-trivial cases. Is that true?

If so, then in C++ and C# they solve this by saying that an empty `throw` is an 
explicit re-propagation [1]. Would this be a possible feature to introduce into 
Harmony?

[1]: http://winterdom.com/2002/09/rethrowingexceptionsinc
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to