Closed Bug 1788538 Opened 2 years ago Closed 2 years ago

structuredClone of Error doesn't clone stack

Categories

(Core :: JavaScript Engine, task)

task

Tracking

()

RESOLVED DUPLICATE of bug 1774866

People

(Reporter: aswan, Unassigned)

References

Details

I just missed adding this to bug 1787546 before it was closed, but it's similar:

function f() { throw new Error("bleah")}
let e;
try { f() } catch (err) { e = err }

console.log(e.stack);  // has the stack you would expect...
console.log(structuredClone(e).stack);  // empty string??

This should work, unless you are doing this on a Worker thread.

See Also: → 1774866

Oh whoops, this does look like a duplicate of 1774866. fwiw, my particular use case is exactly sending an Error from a worker to the main thread with postMessage but it looks like you're already on top of that.

Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.