Re: "ocaml_beginners":: Catching exceptions from OCaml callbacks
>you have to call callback_exn instead of callback and then test for
> I may be missing something here but in Ch 18 of the manual, is there
> anything which describes how to catch the case when a OCaml callback
> throws an exception.
> value foo = callback (*caml_named_value ("my function"), arg);
> and the registered function throws an exception instead of returning
> in the normal way; is there some way to test for this?
Is_exception_result(foo) and if true you can get the raised exception with
Extract_exception(foo). All of theses are defined in lib/caml/callback.h