You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What should the behavior of Error.captureStackTrace be when the object provided is an object with an [[ErrorData]] slot?
My preference right now would be to reset the internal error stack info, but not add a new private field or own stack property (this is partially assuming that we standardize a prototype stack property for Errors in https://github.com/tc39/proposal-error-stacks)
I think my current implementation simply does [[Define]] a new property -- my current implementation doesn't do anything special with the [[ErrorData]] slot.
As a result you'll get a string valued own property "stack" on the provided object with the truncated stack string.
Using the prototype getter you could still get the un-truncated stack (and if we have code in let's say devtools that explicitly manipulates [[ErrorData]] (no idea if we do) they would ignore the own property. d
For the SES purposes, since both Error.prototype.stack and Error.captureStack trace are deniable, I think this is fine behaviour.
Activity
mgaudet commentedon Dec 6, 2024
I think my current implementation simply does [[Define]] a new property -- my current implementation doesn't do anything special with the [[ErrorData]] slot.
For the SES purposes, since both Error.prototype.stack and Error.captureStack trace are deniable, I think this is fine behaviour.
mhofman commentedon Dec 6, 2024
Yeah it might be fine for a data property. Just slightly worried about the consistency of stacks depending on how you consume them.