ES6 and Error Object properties

Kevin Curtis kevinc1846 at googlemail.com
Wed Nov 4 08:10:47 PST 2009


This has probably been chewed over but -

The ES5 spec defines 'name' and 'message' as properties of the Error -
and ReferenceError, SyntaxError etc - objects.

Currently engines have useful additional non-standard properties:
Mozilla - fileName, lineNumber and stack.
V8 - stack (and type, arguments). (The string returned by 'stack' is
not in the same format as Mozilla).
JSC - line, sourceId, sourceURL, expressionBeginOffset,
expressionCaretOffset ,expressionEndOffset - and a few others for
Statement errors.


Any chance for ES6 on standardizing Error object property/ies which
report back the error location.

Maybe a property 'location' on the Error object which returns an object. e.g
e.location ->
{fileName:<filename>, pos: <character posNumber>, line:<lineNumber> ,
lineEnd:<lineNumber>, col:<colNumber> , colEnd:<colNumber>, stack:
<stackString>}

With maybe pos and line being mandatory properties and the other
properties set if they can be set.


More information about the es-discuss mailing list