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
exception Failure and failwith
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Luca Pascali <luca@b...>
Subject: exception Failure and failwith
Hi everyone.

I've ran into a situation and I need a little explanation.

It's all about the failwith function of pervasives (that simply raises 
an exception Failure of string).
Normally, that exception can be cought by means of a try...with using as 
clause something like
| Failure s -> .....

That's good.
But what if I define something (another exception like module Stream 
does), a constructor (like I did) with the name Failure?

Obviously the Ocaml type checker will make all controls with the new 
definition of Failure (starting from that point).
But what if I want to catch the Failure exception? :-/
It seems that no module defines it, so I did not find any way to 
identify the exception.

Thanks to everyone

Luca Pascali
Baretta DE&IT
A division of Baretta SRL

tel. 02 370 111 55
fax. 02 370 111 54

Our technology:


Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB