MDN claims that Chrome supports the non-standard property Error.prototype.lineNumber
"On error object in handled errors.". I fiddled around but wasn't able to verify this.
try
{
throw new Error;
}
catch (error)
{
alert('lineNumber is ' + error.lineNumber);
}
When running the snippet above, only Firefox sets error.lineNumber
to a numeric value. Safari uses a similar non-standard property error.line
, while Chrome doesn't seem to have any similar functionality at all. I know the line number is in the stack
if you parse it, and there are libraries to extract it, but the unclarity bothers me.
Is the MDN documentation outdated or am I missing something here?
I don't think you're missing anything here. If V8 (Chrome's JavaScript engine) supported it at some stage, it certainly doesn't seem to currently, so I guess that falls under MDN's "...the behavior may change in the future." Alternately, remember that MDN is collaboratively-edited, it could just always have been wrong about Chrome supporting it.
As the MDN page says, lineNumber
or something similar is not in the spec.
Given that neither of us sees any indication that V8 supports it, I've corrected the MDN article.