caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Gabriel Scherer <gabriel.scherer@gmail.com>
To: Matthias Puech <puech@cs.unibo.it>
Cc: caml-list@inria.fr
Subject: Re: [Caml-list] Printexc.register_printer without catch
Date: Fri, 13 Apr 2012 11:18:31 +0200	[thread overview]
Message-ID: <CAPFanBHoRdRH9=pjv3nszA6oiqS4O+0z5bU6BSHhExvHYG5onA@mail.gmail.com> (raw)
In-Reply-To: <4F87EDFB.6090409@cs.unibo.it>

It seems Printexc.register_printer affects the other Printexc.*
functions, not the way the toplevel itself (or the runtime system more
generally) handles uncaught exceptions.

# Printexc.register_printer begin function Not_found -> Some "hello" |
_ -> None end;;
- : unit = ()
# (fun () -> raise Not_found) ();;
Exception: Not_found.
# Printexc.print (fun () -> raise Not_found) ();;
Uncaught exception: hello
Exception: Not_found.


On Fri, Apr 13, 2012 at 11:12 AM, Matthias Puech <puech@cs.unibo.it> wrote:
> Hello,
>
> Is there a way to change printing of uncaught exceptions in the toplevel and
> in (native/bytecode, 3.12) compiled code without wrapping the whole code in
> a try ... with or in Printexc.catch?
>
> Printexc.catch's documentation says it is deprecated and that the runtime
> system should be able to print exceptions the way they were registered with
> Printexc.register_printer, yet
>
> # Printexc.register_printer begin function Not_found -> Some "hello" | _ ->
> None end;;
> # raise Not_found;;
> Exception: Not_found.
>
> (* I would expect it to respond [Exception: hello] *)
>
> Do I miss something here?
> Thanks in advance,
>    -m
>
> --
> Caml-list mailing list.  Subscription management and archives:
> https://sympa-roc.inria.fr/wws/info/caml-list
> Beginner's list: http://groups.yahoo.com/group/ocaml_beginners
> Bug reports: http://caml.inria.fr/bin/caml-bugs
>


  reply	other threads:[~2012-04-13  9:19 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13  9:12 Matthias Puech
2012-04-13  9:18 ` Gabriel Scherer [this message]
2012-04-13  9:43   ` Matthias Puech
2012-04-13  9:52     ` Jérémie Dimino
2012-04-13 14:04       ` Matthias Puech
2012-04-13  9:33 ` Mark Shinwell

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='CAPFanBHoRdRH9=pjv3nszA6oiqS4O+0z5bU6BSHhExvHYG5onA@mail.gmail.com' \
    --to=gabriel.scherer@gmail.com \
    --cc=caml-list@inria.fr \
    --cc=puech@cs.unibo.it \
    /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).