On 10/24/07, Xavier Leroy <Xavier.Leroy@inria.fr> wrote:
I recommend the use of Invalid_argument to report "should never
happen" conditions at the boundary between library functions and user
code. On the other hand, the "Failure" exception is a bit of a legacy
from earlier designs (Caml Light and even the original LeLisp-based
Caml), and often is not the best way to report "normal error"
conditions: instead, you could consider defining your own exceptions
as Alain suggested, or even have your functions return "option" types
instead of raising exceptions.