Affects versions: None
Fix versions: None
Native js Error keeps stacktrace:
But ex-info does not:
Problem is that ex-info inherits stack property from prototype which is instantiated at script load time here:
Problem is that Chrome has setter on stack property, and it only allows for this property to be set inside a constructor functions.
Proposed fix creates new Error each time ex-info is called and sets ExceptionInfo.prototype to newly created error. This way new ExceptionInfo instance will inherit stack from newly created Error with correct stack.
This patch has been tested in Chrome 39 Mac, Safari 8 Mac, Firefox 35 Mac and IE 10 Win. Here's test code I used:
Note that current implementation reports line number and overall stacktrace from cljs.core file where Error prototype is created in current implementation.
Note that patched version reports correct line number (it should be close to native error stack), stack, message and exception name.
Also note that IE is fine even without patch — that's because in IE stack is capturead at throw place, not at new Error() call site.