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

[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
Date: -- (:)
From: Olivier Andrieu <andrieu@i...>
Subject: Re: [Caml-list] Matching Unix_error
 Michael Lahr [Thu, 3 Feb 2005]:
 > Hi,
 > 
 > i'm trying something like this:
 > 
 > let start () = 
 >     try pipe#run() with
 >     Unix.Unix_error(_,_,_) -> print_string "matched\n"
 >     | _ -> print_string "not matched\n"; raise e ;
 > 
 > start();;
 > 
 > where pipe is a http_client's pipeline.
 > 
 > The output is:
 > 
 > not matched
 > Fatal error: exception Unix.Unix_error(38, "connect", "")
 > 
 > what's wrong here? shouldn't the expression Unix.Unix_error(_,_,_) match
 > this error?
 > btw this error occurs only when running under oUnit.
 > Any clues?

I had this problem once, it was due to a library that was incorrectly
packaged. The library was built like this :

  ocamlc -a -o foo.cma unix.cma foo.cmo ...

i.e. the library itself included unix.cma. When I built my program
like this :

  ocamlc -o my_prog unix.cma foo.cma my_prog.ml

it had this behavior (the exceptions escaping the try .. with).

-- 
   Olivier