Commit 0089bd4d authored by Pino Toscano's avatar Pino Toscano Committed by Richard W.M. Jones

Register a custom exception printer

This way all the users of ocaml-libvirt can use Printexc.to_string to
print a Virterror exception, even in case they do not catch it
explicitly.
parent d65a679a
......@@ -1616,4 +1616,9 @@ let () =
"ocaml_libvirt_virterror" (Virterror (Virterror.no_error ()));
Callback.register_exception
"ocaml_libvirt_not_supported" (Not_supported "");
c_init ()
c_init ();
Printexc.register_printer (
function
| Virterror e -> Some (Virterror.to_string e)
| _ -> None
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment