Version française
Home     About     Download     Resources     Contact us    
Browse thread
Exception Unix_error problem in toplevel
[ Home ] [ Index: by date | by threads ]
[ Search: ]

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: maranget@y...
Subject: Re: [Caml-list] Exception Unix_error problem in toplevel

> > Summary of problem: If you call a function from a script, that
> > function will raise and catch Unix_error properly.  However, if you
> > call the same function interactively from an OCaml toplevel, the
> > function will see an exception but will think it is *not* Unix_error.
> > A demonstration appears below.
> 

> <...>
> 
> >
> > 	$ ocaml unix.cma bug.cmo
> > 	        Objective Caml version 3.09.2
> > 	
> > 	# Bug.delete_file ();;
> > 	Some other error.
> 
> 
> I couldn't reproduce that on Debian Sarge (Stable is Sarge as of this
> date) neither with


May I suggest that Bob Williams reproduces the bug
with the following bug.ml file, and that he reports results.



open Unix
open Printf

let delete_file () =
  try
    unlink "no_such"
  with
  | Unix_error (_, _, _) -> Printf.eprintf "Unix error.\n%!"
  | e                    ->
      Printf.eprintf "Some other exception %s\n" (Printexc.to_string  e)


--Luc