caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* Matching Unix_error
@ 2005-02-03 11:17 Michael Lahr
  2005-02-03 12:40 ` [Caml-list] " Olivier Andrieu
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Lahr @ 2005-02-03 11:17 UTC (permalink / raw)
  To: caml-list

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?

Michael
-- 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Matching Unix_error
  2005-02-03 11:17 Matching Unix_error Michael Lahr
@ 2005-02-03 12:40 ` Olivier Andrieu
  2005-02-03 12:55   ` Michael Lahr
  0 siblings, 1 reply; 3+ messages in thread
From: Olivier Andrieu @ 2005-02-03 12:40 UTC (permalink / raw)
  To: m.lahr; +Cc: caml-list

 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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [Caml-list] Matching Unix_error
  2005-02-03 12:40 ` [Caml-list] " Olivier Andrieu
@ 2005-02-03 12:55   ` Michael Lahr
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Lahr @ 2005-02-03 12:55 UTC (permalink / raw)
  To: caml-list

Olivier Andrieu <andrieu@ijm.jussieu.fr>:
> 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).
Thanks, this was indeed the cause of the problem.

Michael
-- 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-02-03 12:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-02-03 11:17 Matching Unix_error Michael Lahr
2005-02-03 12:40 ` [Caml-list] " Olivier Andrieu
2005-02-03 12:55   ` Michael Lahr

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).