[
Home
]
[ Index:
by date
|
by threads
]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
[ Message by date: previous | next ] [ Message in thread: previous | next ] [ Thread: previous | next ]
| Date: | -- (:) |
| From: | Virgile Prevosto <virgile.prevosto@m...> |
| Subject: | Re: [Caml-list] Printexc cannot print some (but not all) exceptions |
Hello Richard,
Le ven 13 jan 2006 15:23:34 CET, Richard Jones a écrit:
> Hi,
>
> We have an annoying problem that sometimes Printexc seems unable to
> print exceptions. Http_client.Http_error is one such exception that
> seems like it can never be printed:
>
> Http_client.Http_error(_) # from
> Printexc.to_string (("Http_client.Http_error"), (2, "foobar")) #
> I don't understand what the common factor is which stops exceptions
>
> ------------------------------------------------------------- print.ml
> exception MyException of int * string;;
I'd guess that your Http_error is an exception taking one argument which
happens to be a pair, instead of two arguments (like MyException does).
Remember that, as with sum types, the two definitions:
exception OneArg of (int * string) ;;
exception TwoArg of int * string ;;
are not equivalent. Moreover, OneArg has the same behavior as Http_error:
# Printexc.to_string (OneArg (0,"foo"));;
- : string = "OneArg(_)"
# exception TwoArg of int * string ;;
exception TwoArg of int * string
# Printexc.to_string (TwoArg (0,"foo"));;
- : string = "TwoArg(0, \"foo\")"
--
E tutto per oggi, a la prossima volta
Virgile