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 <pu...@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
>


-- 
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 via email to