ES5 question: Error object property 'message' - enumerable or not?
Thomas L. Shinnick
tshinnic at prismnet.com
Sat Sep 3 11:59:18 PDT 2011
An issue popped up where V8 recently made everything in Error objects
non-enumerable. This was surprising to some apps. More surprising
is the insistence that this is required by the ES5 spec.
As a simplistic reader, when "own property" is mentioned here
15.11.2.1 new Error (message)
If the argument message is not undefined, the message own property
of the newly constructed object is set to ToString(message).
I just naturally think this property it is not supposed to be
mysteriously unseen. Yet other general statements in the spec have
people think everything not explicitly labeled enumerable _can't_ be.
http://code.google.com/p/v8/issues/detail?id=1215 "But the spec
is the spec"
http://code.google.com/p/v8/issues/detail?id=1595 "...this
consequence may have been unintended."
Does the ES5 spec intend for 'message' property of Error objects to
be non-enumerable?
More information about the es-discuss
mailing list