W3C home > Mailing lists > Public > whatwg@whatwg.org > February 2010

[whatwg] Structured clone for an Error object

From: ATSUSHI TAKAYAMA <taka.atsushi@googlemail.com>
Date: Thu, 25 Feb 2010 23:21:18 -0500
Message-ID: <9cef076f1002252021u4ccb5df1pb3b020a65445cf02@mail.gmail.com>
Hi,

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)

A. TAKAYAMA
Received on Thursday, 25 February 2010 20:21:18 UTC

This archive was generated by hypermail 2.4.0 : Wednesday, 22 January 2020 16:59:21 UTC