[whatwg] Structured clone for an Error object

ATSUSHI TAKAYAMA taka.atsushi at googlemail.com
Thu Feb 25 20:21:18 PST 2010


Right now, in the spec "2.7.5 Safe passing of structured data", it says

If input is another native object type (e.g. Error)
Return the null value.

but if we want to debug workers, it's more convenient to be able to
pass the error directly rather than

postMessage({name: err.name, message: err.message})

which loses all information like line number, etc. or we will just
start cloning every property of the Error (stack, lineNumber,
stacktrace, etc depending on the browser).

I think that's an unnecessary chore for all developers. We should just
be able to postMessage an error.

(of course, the best solution would be to be able to console.debug
from a worker thread, but it's not a standard way yet)


More information about the whatwg mailing list