caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Fabrice Le Fessant <fabrice.le_fessant@inria.fr>
To: "Marcin 'Qrczak' Kowalczyk" <qrczak@knm.org.pl>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Looking up exceptions in a dictionary
Date: Mon, 5 Nov 2001 10:29:08 +0100 (CET)	[thread overview]
Message-ID: <15334.23524.25520.167099@lachesis.inria.fr> (raw)
In-Reply-To: <slrn9ucoqn.4an.qrczak@qrnik.zagroda>


In the CDK, there is a Printexc2 module  which allows users to specify
printers for exceptions, that can be used by Printexc.to_string. The
way this is implemented is:

1- when a printer is registered, it has type exn -> string. Such a
printer is:

let not_found_handler exn = match exn with
  Not_found -> "Not Found"
| _ -> raise exn

Thus, it reraises the excepion  if it can not print it.

2- In Printexc.to_string, each printer is tried until a string is
returned. This doesn't require to know about the internal structure of
exceptions. 

- Fabrice

-------------------
Bug reports: http://caml.inria.fr/bin/caml-bugs  FAQ: http://caml.inria.fr/FAQ/
To unsubscribe, mail caml-list-request@inria.fr  Archives: http://caml.inria.fr


  reply	other threads:[~2001-11-05 10:28 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-05 10:00 Marcin 'Qrczak' Kowalczyk
2001-11-05  9:29 ` Fabrice Le Fessant [this message]
2001-11-05 10:18 ` Xavier Leroy

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=15334.23524.25520.167099@lachesis.inria.fr \
    --to=fabrice.le_fessant@inria.fr \
    --cc=caml-list@inria.fr \
    --cc=qrczak@knm.org.pl \
    /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).