tc39 / proposal-error-stacks

ECMAScript Proposal, specs, and reference implementation for Error.prototype.stack / System.getStack
https://tc39.github.io/proposal-error-stacks/
MIT License
168 stars 13 forks source link

"span" may need to be optional #27

Open ljharb opened 5 years ago

ljharb commented 5 years ago

Although currently I believe every implementation always provides a span, @michaelficarra has raised the concern that builtins may want the option in the future to omit position information, particularly as it relates to implementation hiding.

It seems reasonable to make the span optional in preparation for this, so that users working with the stack frame structure won't rely on its presence.

ljharb commented 5 years ago

cc @erights @domenic

domenic commented 5 years ago

https://jsbin.com/celomim/edit?html,console,output in Chrome seems to indicate no span (e.g. the at Number (<anonymous>) line), although I didn't spend too much time figuring out exactly what span is.

ljharb commented 5 years ago

Indeed you're right; this is what I see in Safari:

"valueOf@https://null.jsbin.com/runner:6:32
Number@[native code]
map@[native code]
global code@https://null.jsbin.com/runner:9:6
write@[native code]
https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:13929
https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:10867"

and in Chrome:

"Error: check my stack
    at Object.valueOf (<anonymous>:6:23)
    at Number (<anonymous>)
    at Array.map (<anonymous>)
    at <anonymous>:9:3
    at https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:13924
    at https://static.jsbin.com/js/prod/runner-4.1.7.min.js:1:10866"

so both of these omit the Span; it'll thus have to be optional regardless.