Error stack

Charles Kendrick charles at
Fri Jun 8 16:33:52 PDT 2012

No, this doesn't work.

When you are in the catch() block you can discover the arguments for
the function that contains the catch block and for any (non-recursive)
functions further up the stack.  But you cannot discover the arguments
for functions that were on the stack when the error happened, but have
exited by the time you hop back to the catch block.

Your test happens to sidestep this because the catch block is in the
function that throws the error.  But the more important scenario is
that a function somewhere down stack has crashed and you want to see
what the arguments were when the crash occurred - because those are
the arguments most valuable to know from a troubleshooting

My test code for the V8 issue demonstrates this problem:

On Fri, Jun 8, 2012 at 3:25 PM, Brandon Benvie
<brandon at> wrote:
> You can get the arguments. Here's an example of getting more info out of a
> try..catch:
> Which results in error.stack being an array of objects like (function,
> arguments, and receiver are actual function/array/object)
> {
>   function: <function>,
>   name: "InjectedScript._evaluateOn",
>   inferredName: "_evaluateOn",
>   arguments: <Array[5]>,
>   invocationType: "call",
>   receiver: <receiver>,
>   inferredType: "Object",
>   origin: undefined,
>   column: 33,
>   line: 343,
>   position: 12853,
>   type: "file"
> };

More information about the es-discuss mailing list