From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from majordomo@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id LAA12011; Mon, 5 Nov 2001 11:28:13 +0100 (MET) 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 LAA12108 for ; Mon, 5 Nov 2001 11:28:13 +0100 (MET) Received: from lachesis.inria.fr (lachesis.inria.fr [128.93.52.5]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id fA5AS0H01839; Mon, 5 Nov 2001 11:28:00 +0100 (MET) Received: (from lefessan@localhost) by lachesis.inria.fr (8.11.3/8.11.3) id fA59TFQ09242; Mon, 5 Nov 2001 10:29:15 +0100 X-Authentication-Warning: lachesis.inria.fr: lefessan set sender to fabrice.le_fessant@inria.fr using -f From: Fabrice Le Fessant MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Message-ID: <15334.23524.25520.167099@lachesis.inria.fr> Date: Mon, 5 Nov 2001 10:29:08 +0100 (CET) To: "Marcin 'Qrczak' Kowalczyk" Cc: caml-list@inria.fr Subject: Re: [Caml-list] Looking up exceptions in a dictionary References: X-Mailer: VM 6.75 under Emacs 20.7.1 Reply-To: fabrice.le_fessant@inria.fr Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk In the CDK, there is a Printexc2 module which allows users to specify printers for exceptions, that can be used by Printexc.to_string. The way this is implemented is: 1- when a printer is registered, it has type exn -> string. Such a printer is: let not_found_handler exn = match exn with Not_found -> "Not Found" | _ -> raise exn Thus, it reraises the excepion if it can not print it. 2- In Printexc.to_string, each printer is tried until a string is returned. This doesn't require to know about the internal structure of exceptions. - Fabrice ------------------- Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr