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 QAA19134; Mon, 10 Jun 2002 16:27:27 +0200 (MET DST) X-Authentication-Warning: pauillac.inria.fr: majordomo set sender to owner-caml-list@pauillac.inria.fr using -f Received: from nez-perce.inria.fr (nez-perce.inria.fr [192.93.2.78]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id QAA19149 for ; Mon, 10 Jun 2002 16:27:26 +0200 (MET DST) Received: from mailcity.com (fes2.mail.lycos.com [209.185.123.102]) by nez-perce.inria.fr (8.11.1/8.11.1) with SMTP id g5AERP904709 for ; Mon, 10 Jun 2002 16:27:25 +0200 (MET DST) Received: from Unknown/Local ([?.?.?.?]) by mailcity.com; Mon Jun 10 07:27:15 2002 To: caml-list@pauillac.inria.fr Date: Mon, 10 Jun 2002 07:27:15 -0700 From: "Gaurav Chanda" Message-ID: Mime-Version: 1.0 X-Sent-Mail: off Reply-To: gaurav_chanda@lycos.com X-Mailer: MailCity Service X-Priority: 3 Subject: [Caml-list] Catching exceptions into strings X-Sender-Ip: 128.93.8.52 Organization: Lycos Mail (http://www.mail.lycos.com:80) Content-Type: text/plain; charset=us-ascii Content-Language: en Content-Transfer-Encoding: 7bit Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk Hello I want to catch exceptions into strings. I do not want to have pre-defined exceptions in my module which can be handled. I want to catch exceptions like "floating point exceptions" etc. I wrote the follwing piece of code: value divide2 p = 2/p ; value foo p = try divide2 p with [e -> let _ = do {print_string (Printexc.to_string e);flush stdout} in 9]; value _ = foo 0; (This code is in the Camlp4 revised syntax). When I compile and run this code, I get : Floating point exception However, after loading OCAML, if I use this file, I get value divide2 : int -> int = value arbit : int -> int = Division_by_zero That is, in the latter case, I get what I want but in the former case, I don't. Could you help me solve this problem ? Gaurav _______________________________________________________ WIN a first class trip to Hawaii. Live like the King of Rock and Roll on the big Island. Enter Now! http://r.lycos.com/r/sagel_mail/http://www.elvis.lycos.com/sweepstakes ------------------- To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/ Beginner's list: http://groups.yahoo.com/group/ocaml_beginners