summaryrefslogtreecommitdiffstats
path: root/ocaml
diff options
context:
space:
mode:
authorRichard Jones <rjones@trick.home.annexia.org>2009-09-29 11:56:26 +0100
committerRichard Jones <rjones@trick.home.annexia.org>2009-09-29 11:56:26 +0100
commitd278ef8ad9090441a713c7334804199318aeb3e1 (patch)
treec6d32ff94ca5c10afeadbdc01e3c28613b6f625a /ocaml
parent4c8bdd342450aad1f49a44a009eae015a44f9572 (diff)
downloadlibguestfs-d278ef8ad9090441a713c7334804199318aeb3e1.tar.gz
libguestfs-d278ef8ad9090441a713c7334804199318aeb3e1.tar.xz
libguestfs-d278ef8ad9090441a713c7334804199318aeb3e1.zip
OCaml viewer: Handle exceptions properly.
Diffstat (limited to 'ocaml')
-rw-r--r--ocaml/examples/viewer.ml9
1 files changed, 8 insertions, 1 deletions
diff --git a/ocaml/examples/viewer.ml b/ocaml/examples/viewer.ml
index 20fa608a..ef6627b1 100644
--- a/ocaml/examples/viewer.ml
+++ b/ocaml/examples/viewer.ml
@@ -227,6 +227,7 @@ end = struct
*)
debug "Slave.slave_loop: command failed";
+ !busy_cb `Idle;
with_lock q_lock (fun () -> Q.clear q);
GtkThread.async !failure_cb exn
);
@@ -383,7 +384,13 @@ type display_state = {
* necessary to turn the exception into an error message.
*)
let failure ds exn =
- debug "failure callback: %s" (Printexc.to_string exn)
+ let title = "Error" in
+ let msg = Printexc.to_string exn in
+ debug "failure callback: %s" msg;
+ let icon = GMisc.image () in
+ icon#set_stock `DIALOG_ERROR;
+ icon#set_icon_size `DIALOG;
+ GToolbox.message_box ~title ~icon msg
(* This is called in the main thread when the slave thread transitions
* to busy or idle.