[whatwg] Error propagation in child workers
Ian Hickson
ian at hixie.ch
Tue Dec 16 02:56:06 PST 2008
On Thu, 27 Nov 2008, ben turner wrote:
>
> I just got around to fixing the error handling in our worker
> implementation and realized that the spec is a little vague here,
> especially when workers are created within workers. This is what we have
> now, and Jonas and I both find it intuitive and useful:
>
> Assuming we have a page that creates a worker (let's call this worker
> the parent), and it creates a new worker (the child).
>
> First, we currently use a MessageEvent object for our 'error' events
> where the 'data' property contains a string representing the exception,
> but we don't really like that. We'd like to propose that we use a new
> type of event, ErrorEvent, that looks like this:
>
> interface ErrorEvent : Event {
> readonly attribute DOMString message;
> readonly attribute DOMString filename;
> readonly attribute unsigned long lineno;
> }
How do you feel instead about using the same mechanism on Worker objects
as we currently use on Window for error handling?
Specifically, window.onerror is called as a function with three arguments
when an error occurs. I'm suggesting that when a worker has an unhandled
exception, we fire Worker.onerror outside the worker, again with three
arguments (message, script url, line number). If the function return
false, then the error reporting is quenched; otherwise, it is reported in
the warning console.
For shared workers, we could either support this in the same way, or
always report the errors to the console and not have a way to catch them.
Or, we could not have any ways to catch these unhandled exceptions at all.
I'm interested in feedback from other implementors here -- is this
something you are interested in?
--
Ian Hickson U+1047E )\._.,--....,'``. fL
http://ln.hixie.ch/ U+263A /, _.. \ _\ ;`._ ,.
Things that are impossible just take longer. `._.-(,_..'--(,_..'`-.;.'
More information about the whatwg
mailing list