Closed dougwilson closed 10 years ago
Strangely this only seems to happen when using the Error.captureStackTrace(obj, fn)
form, where fn
is a set function name.
Scratch that; there just seems to be some weird side-effects going on (not sure if this is a v8 bug, but that doesn't matter to Node.js even if it is because it'll just never get fixed :) ). Adding an enormous for
loop to slow it down has no effect, but accessing arguments.callee
within the body will magically fix it (but not other properties of arguments
). This makes it seem like the bug is that for some reason, it will not think the stack contains the calling function under weird conditions, thus the stack gets chopped down to zero length.
The simplest solution for now is to not have Error.captureStackTrace
limit the stack and instead manually slice off the top.
In v8, when rapidly calling
Error.captureStackTrace
, an empty stack trace will end up being returned. This module needs to handle that case.