English version
Accueil     À propos     Téléchargement     Ressources     Contactez-nous    

Ce site est rarement mis à jour. Pour les informations les plus récentes, rendez-vous sur le nouveau site OCaml à l'adresse ocaml.org.

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: 2005-06-21 (08:34)
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