Version française
Home     About     Download     Resources     Contact us    

This site is updated infrequently. For up-to-date information, please visit the new OCaml website at

Browse thread
[OSR] Exceptionless error management, take 2
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: 2008-02-07 (16:25)
From: David Teller <David.Teller@u...>
Subject: Re: [Caml-list] [OSR] Exceptionless error management, take 2
That's an interesting question. I believe we all agree, starting with
Xavier Leroy, that 'Failure of string' was a quick-and-dirty solution
with which we're stuck but should be brushed under the carpet as soon as
possible. In fact, that's one of the problems this recommendation should
help resolve.

Now, concerning hierarchies. My personal experience with Java's
exception hierarchies (which I assume are similar to .Net's) is that the
only circumstance in which I've taken advantage of subtyping was to
relate every exception to the mother-class Exception:

catch(Exception e) //Deal with all exceptions at once, for instance
                   //by turning them into instances of RuntimeError 

Does anyone have a different experience on the subject ?


On Thu, 2008-02-07 at 15:33 +0000, Jon Harrop wrote:
> There is also some merit in the hierarchical classification of exceptions, 
> e.g. as .NET provides (class hierarchies). For example, you might make 
> Invalid_argument a base exception with derived exceptions for each of the 
> different functions that raise this exception, in order to carry more precise 
> information about what exactly went wrong. OCaml's current approach of 
> conveying a string argument is not in the API and feels unhygienic as a 
> consequence. Like brushing your teeth whilst on the toilet. We all do it, but 
> only because we're in a hurry and not because it is an inherently good idea.

David Teller
 Security of Distributed Systems
 Angry researcher: French Universities need reforms, but the LRU act
brings liquidations.