Error stack

Erik Arvidsson erik.arvidsson at
Thu Jun 7 13:39:47 PDT 2012

On Thu, Jun 7, 2012 at 1:12 PM, Jason Orendorff
<jason.orendorff at> wrote:
> This isn't machine parseable in all cases, since the .message may
> contain newlines and can end with something like "\n  at ..."

That is a good point. This also applies to the "name" of a function
(and object when included). It is trivial to create a function "name"
that breaks the V8 style formatting. SpiderMonkey "gets" away with
this by using the name of the function expression and it does not try
to deduce a name based on the code..

window['\n@'] = function() {
  alert(new Error().stack);

When I first set out to write the proposal I was set on the
SpiderMonkey formatting but as I researched this I drifted closer and
closer to the V8 formatting. The thing that convinced me was eval.

I also don't think that providing ErrorName: ErrorMessage is a hard
requirement. The same information is already available using and errorObject.message.

If we remove the first line and require that non identifiers are
quoted I think we can guarantee that the value is machine parseable

> Changing this in Firefox would affect any Firefox addons that use
> Error.stack, but maybe we can take that hit.

For web apps we already have to parse two different versions so I'm
not too concerned about that case. The WebKit mobile web does not
depend on either format (Safari doesn't have it in any shipping
version yet) so the two problematic big eco systems are Firefox and
Chrome extensions (and Node.js?)


More information about the es-discuss mailing list