From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Original-To: caml-list@yquem.inria.fr 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 49152BB81 for ; Fri, 13 Jan 2006 16:54:36 +0100 (CET) Received: from beaune.inria.fr (beaune.inria.fr [128.93.8.3]) by concorde.inria.fr (8.13.0/8.13.0) with ESMTP id k0DFsZjH026283 for ; Fri, 13 Jan 2006 16:54:36 +0100 Received: from localhost.localdomain by beaune.inria.fr (8.8.8/1.1.22.3/14Sep99-0328PM) id QAA0000007050; Fri, 13 Jan 2006 16:54:35 +0100 (MET) Date: Fri, 13 Jan 2006 16:54:36 +0100 From: Virgile Prevosto To: caml-list@yquem.inria.fr Subject: Re: [Caml-list] Printexc cannot print some (but not all) exceptions Message-ID: <20060113165436.1e64f458@localhost.localdomain> In-Reply-To: <20060113152333.GA14618@furbychan.cocan.org> References: <20060113152333.GA14618@furbychan.cocan.org> X-Mailer: Sylpheed-Claws 1.9.100 (GTK+ 2.8.9; i486-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Miltered: at concorde with ID 43C7CD3C.000 by Joe's j-chkmail (http://j-chkmail.ensmp.fr)! X-Spam: no; 0.00; caml-list:01 printexc:01 printexc:01 foobar:01 foo:01 foo:01 tutto:98 oggi:98 volta:98 exception:01 exception:01 pair:01 exceptions:01 exceptions:01 argument:01 X-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on yquem.inria.fr X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=none autolearn=disabled version=3.0.3 Hello Richard, Le ven 13 jan 2006 15:23:34 CET, Richard Jones a écrit: > Hi, > > We have an annoying problem that sometimes Printexc seems unable to > print exceptions. Http_client.Http_error is one such exception that > seems like it can never be printed: > > Http_client.Http_error(_) # from > Printexc.to_string (("Http_client.Http_error"), (2, "foobar")) # > I don't understand what the common factor is which stops exceptions > > ------------------------------------------------------------- print.ml > exception MyException of int * string;; I'd guess that your Http_error is an exception taking one argument which happens to be a pair, instead of two arguments (like MyException does). Remember that, as with sum types, the two definitions: exception OneArg of (int * string) ;; exception TwoArg of int * string ;; are not equivalent. Moreover, OneArg has the same behavior as Http_error: # Printexc.to_string (OneArg (0,"foo"));; - : string = "OneArg(_)" # exception TwoArg of int * string ;; exception TwoArg of int * string # Printexc.to_string (TwoArg (0,"foo"));; - : string = "TwoArg(0, \"foo\")" -- E tutto per oggi, a la prossima volta Virgile