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 CAA00115; Sat, 31 Jan 2004 02:53:10 +0100 (MET) 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 CAA01141 for ; Sat, 31 Jan 2004 02:53:08 +0100 (MET) Received: from bob.west.spy.net (mail.west.spy.net [66.149.231.226]) by nez-perce.inria.fr (8.11.1/8.11.1) with ESMTP id i0V1r7v09345 for ; Sat, 31 Jan 2004 02:53:08 +0100 (MET) Received: from [10.9.254.240] (sjc-dist3-e3.2wire.com [63.203.253.2]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client did not present a certificate) by bob.west.spy.net (Postfix) with ESMTP id 1AB2A59D9; Fri, 30 Jan 2004 17:52:52 -0800 (PST) In-Reply-To: <1B178E7D-5389-11D8-B58E-000A95A1E69A@csun.edu> References: <979ADAF0-1034-11D8-ADB5-000393CFE6B8@spy.net> <20031106090201.GA9550@redhat.com> <1B178E7D-5389-11D8-B58E-000A95A1E69A@csun.edu> Mime-Version: 1.0 (Apple Message framework v609) Content-Type: text/plain; charset=US-ASCII; format=flowed Message-Id: Content-Transfer-Encoding: 7bit Cc: Caml List From: Dustin Sallings Subject: Re: [Caml-list] exception handling questions Date: Fri, 30 Jan 2004 17:50:23 -0800 To: Eric Stokes X-Mailer: Apple Mail (2.609) X-Loop: caml-list@inria.fr X-Spam: no; 0.00; caml-list:01 endline:01 runtime:01 deployed:01 printexc:01 endline:01 printexc:01 rec:01 unlikely:02 exception:02 module:03 string:03 string:03 wrote:03 let:04 Sender: owner-caml-list@pauillac.inria.fr Precedence: bulk On Jan 30, 2004, at 17:02, Eric Stokes wrote: > What about doing this. > > let rec should_process fn = > try > (ends_with fn ".") && (is_new_enough fn) && (not (is_gzip fn)) > with x -> > print_endline("Unknown error determining whether to process " > ^ fn); > should_process fn > ;; > > You may need to maintain a bit more state in various places, but it > could work > the way you want. fn is a string, so feeding the same value back in wouldn't help. The real problem here was a runtime failure in one of the functions that is very unlikely to occur where this program is actually deployed. I just wanted to make sure that when a failure did occur, it was dealt with properly. The ``unknown error'' part was my biggest concern, because I really didn't have a way to know what went wrong. The answer to my main concern was the Printexc module: let should_process fn = try (ends_with fn ".") && (is_new_enough fn) && (not (is_gzip fn)) with x -> print_endline("Unknown error determining whether to process " ^ fn); print_endline (Printexc.to_string x); false -- Dustin Sallings ------------------- 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