+let pretty_string_of_exn =
+ function
+ | Guestfs.Error str ->
+ "Libguestfs error",
+ sprintf "libguestfs reported an error:
+
+%s
+
+To get more information about libguestfs errors, run guestfs-browser
+with the -x flag on the command line."
+ str
+
+ | Libvirt.Virterror err ->
+ "Libvirt error",
+ sprintf "libvirt reported an error:
+
+%s
+
+To get more information about libvirt errors, run guestfs-browser
+from the command line like this:
+
+LIBVIRT_DEBUG=1 guestfs-browser"
+ (Libvirt.Virterror.to_string err)
+
+ (* Add more exception types here as we come across them. Last
+ * case below is the catch-all.
+ *)
+ | exn ->
+ let str = Printexc.to_string exn in
+ debug "pretty_string_of_exn: unhandled exception %s" str;
+ "Error", str
+