| Xenvmlib.Error err -> DBus.Message.new_error msg DBus.ERR_FAILED err
| _ -> DBus.Message.new_error msg DBus.ERR_FAILED "?"
in
+ let do_task_exn state x =
+ try xenvmlib_to_dbus (do_task state x)
+ with exn ->
+ let s = sprintf "exception: %s" (Printexc.to_string exn) in
+ DBus.Message.new_error msg DBus.ERR_FAILED s
+ in
(* if the tasks need to be threaded like start,reboot,.. we returns
none to the caller and create a thread that is going to populate a queue
with the return message when ready *)
if task_descr.Tasks.need_threading then (
info "creating thread for handling %s" msg_method;
thread_create (fun () ->
- let rep = do_task state (act, taskargs) in
- let rep = xenvmlib_to_dbus rep in
+ let rep = do_task_exn state (act, taskargs) in
Mutex.execute outgoing_mutex (fun () -> Queue.push rep outgoing);
) ();
None
) else
- Some (xenvmlib_to_dbus (do_task state (act, taskargs)))
+ Some (do_task_exn state (act, taskargs))
in
let process_method_call msg =