W3C home > Mailing lists > Public > whatwg@whatwg.org > December 2008

[whatwg] Error propagation in child workers

From: Ian Hickson <ian@hixie.ch>
Date: Tue, 16 Dec 2008 10:56:06 +0000 (UTC)
Message-ID: <Pine.LNX.4.62.0812161052030.30225@hixie.dreamhostps.com>
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.   `._.-(,_..'--(,_..'`-.;.'
Received on Tuesday, 16 December 2008 02:56:06 UTC

This archive was generated by hypermail 2.3.1 : Monday, 13 April 2015 23:08:46 UTC