From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Delivered-To: caml-list@yquem.inria.fr Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by yquem.inria.fr (Postfix) with ESMTP id DF1E1BBFB for ; Tue, 21 Jun 2005 11:30:19 +0200 (CEST) Received: from pauillac.inria.fr (pauillac.inria.fr [128.93.11.35]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5L9UJQw008893 for ; Tue, 21 Jun 2005 11:30:19 +0200 Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id LAA28011 for ; Tue, 21 Jun 2005 11:30:19 +0200 (MET DST) Received: from ext.lri.fr (ext.lri.fr [129.175.15.4]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id j5L9UISu008890 (version=TLSv1/SSLv3 cipher=EDH-RSA-DES-CBC3-SHA bits=168 verify=NO) for ; Tue, 21 Jun 2005 11:30:18 +0200 Received: from localhost (localhost [127.0.0.1]) by ext.lri.fr (Postfix) with ESMTP id 95C4419E76B; Tue, 21 Jun 2005 11:30:18 +0200 (CEST) Received: from ext.lri.fr ([127.0.0.1]) by localhost (ext.lri.fr [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 03500-07; Tue, 21 Jun 2005 11:30:18 +0200 (CEST) Received: from smtp.lri.fr (serveur3-5 [129.175.3.5]) by ext.lri.fr (Postfix) with ESMTP id 818C919E71D; Tue, 21 Jun 2005 11:30:18 +0200 (CEST) Received: from pc8-102 (pc8-102 [129.175.8.102]) by smtp.lri.fr (Postfix) with ESMTP id 323DACED98; Tue, 21 Jun 2005 11:30:18 +0200 (CEST) Received: from pc8-102 ([127.0.0.1] helo=localhost) by pc8-102 with esmtp (Exim 3.36 #1 (Debian)) id 1Dkf5F-0003Ui-00; Tue, 21 Jun 2005 11:30:17 +0200 Date: Tue, 21 Jun 2005 11:30:17 +0200 (CEST) From: Julien Signoles X-X-Sender: signoles@pc8-102 To: Luca Pascali Cc: caml-list@inria.fr Subject: Re: [Caml-list] exception Failure and failwith In-Reply-To: <42B7D0FD.5090305@barettadeit.com> Message-ID: References: <42B7D0FD.5090305@barettadeit.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Virus-Scanned: by amavisd-new at lri.fr X-Miltered: at concorde with ID 42B7DE2B.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Miltered: at concorde with ID 42B7DE2A.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; signoles:01 signoles:01 lri:01 caml-list:01 failwith:01 failwith:01 pervasives:01 defines:01 defines:01 endline:01 endline:01 redefined:01 lri:01 ...:98 .....:98 X-Spam-Checker-Version: SpamAssassin 3.0.2 (2004-11-16) on yquem.inria.fr X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.2 X-Spam-Level: > 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 -> ..... > > 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. You're right: no module defines Failure. But you can make an alias for the primitive Failure and use it: ========== exception Prim_Failure = Failure exception Failure let f () = failwith "" let () = try f (); assert false with Prim_Failure _ -> print_endline "primitive failure" | Failure -> print_endline "redefined failure" ========== Hope this helps, Julien Signoles -- mailto:Julien.Signoles@lri.fr ; http://www.lri.fr/~signoles "In theory, practice and theory are the same, but in practice they are different" (Larry McVoy)