Re: ISSUE-2 (error-handling): Error handling style [APIs General]

On Sep 1, 2009, at 11:44 , Anne van Kesteren wrote:
> On Tue, 01 Sep 2009 11:36:12 +0200, Robin Berjon <>  
> wrote:
>> In other words I'm not saying it's necessarily the hardest, most  
>> technical of debates, just that it needs to be decided. Strawmen  
>> and proposals welcome.
> I'd like to argue for not having a common style. Different problems  
> require different APIs and different APIs require different kind of  
> error handling.

Sorry if I was unclear, the idea is not to define ex nihilo one single  
style to be brutally applied in all cases. I don't think anyone wants  
a straightjacket here. What I had in mind was more along the lines of  
rules of thumb that we can point to to avoid excessive future debate.  
In fact, you go on to list pretty much the sort of stuff that I had in  

> If a problem requires an event driven API you'd use an error event  
> perhaps with an appropriate interface. If a problem requires a  
> callback API you'd use an additional argument that gets called with  
> an error object. If you have a synchronous API of some sorts to be  
> used within Web Workers you'd use exceptions. You'd also use  
> exceptions in case the "API object" can be in different states and a  
> method gets called in the wrong state. Or when a method gets invoked  
> with an argument that doesn't meet expectations (e.g. an invalid URL).

That looks like a pretty good start to me. There are a few other  
questions such as BONDI's interface versus exception thing but if  
people agree with the above I don't think we need much more.

Robin Berjon -

Received on Tuesday, 1 September 2009 13:43:39 UTC