caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Virgile Prevosto <virgile.prevosto@m4x.org>
To: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Printexc cannot print some (but not all) exceptions
Date: Fri, 13 Jan 2006 16:54:36 +0100	[thread overview]
Message-ID: <20060113165436.1e64f458@localhost.localdomain> (raw)
In-Reply-To: <20060113152333.GA14618@furbychan.cocan.org>

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


  reply	other threads:[~2006-01-13 15:54 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-13 15:23 Richard Jones
2006-01-13 15:54 ` Virgile Prevosto [this message]
2006-01-13 16:36   ` [Caml-list] " Richard Jones
2006-01-13 17:23     ` Virgile Prevosto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060113165436.1e64f458@localhost.localdomain \
    --to=virgile.prevosto@m4x.org \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).