[gnome-boxes] installer-media: prepare_for_installation() throws no error



commit 15d61d1ec1bc4c0829f497146fa4db5528b4cf7a
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Fri Oct 24 00:18:45 2014 +0100

    installer-media: prepare_for_installation() throws no error
    
    Since the only real implementation of prepare_for_installation() (in
    UnattendedInstaller) handles errors itself anyway and error is ingorable
    (and is ignored), there is no need to burdon the caller (VMCreator) with
    the error as well. The error catching code in VMCreator was also
    assuming internal details of this method so now it doesn't have to.

 src/installer-media.vala      |    2 +-
 src/unattended-installer.vala |    7 ++++---
 src/vm-creator.vala           |    9 +--------
 3 files changed, 6 insertions(+), 12 deletions(-)
---
diff --git a/src/installer-media.vala b/src/installer-media.vala
index 30b0ca2..a520b14 100644
--- a/src/installer-media.vala
+++ b/src/installer-media.vala
@@ -84,7 +84,7 @@ private class Boxes.InstallerMedia : GLib.Object {
     public virtual void set_direct_boot_params (DomainOs os) {}
     public virtual async void prepare (ActivityProgress progress = new ActivityProgress (),
                                        Cancellable? cancellable = null) {}
-    public virtual async void prepare_for_installation (string vm_name, Cancellable? cancellable) throws 
GLib.Error {}
+    public virtual async void prepare_for_installation (string vm_name, Cancellable? cancellable) {}
     public virtual void prepare_to_continue_installation (string vm_name) {}
     public virtual void clean_up () {
         clean_up_preparation_cache ();
diff --git a/src/unattended-installer.vala b/src/unattended-installer.vala
index 7d9b401..48116fe 100644
--- a/src/unattended-installer.vala
+++ b/src/unattended-installer.vala
@@ -142,7 +142,7 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
         }
     }
 
-    public override async void prepare_for_installation (string vm_name, Cancellable? cancellable) throws 
GLib.Error {
+    public override async void prepare_for_installation (string vm_name, Cancellable? cancellable) {
         if (!setup_box.express_install) {
             debug ("Unattended installation disabled.");
 
@@ -185,8 +185,9 @@ private class Boxes.UnattendedInstaller: InstallerMedia {
             // installation will work. When this happens, just disable unattended installs, and let the 
caller decide
             // if it wants to retry a non-automatic install or to just abort the box creation..
             setup_box.express_install = false;
-
-            throw error;
+            var msg = _("An error occurred during installation preparation. Express Install disabled.");
+            App.app.main_window.notificationbar.display_error (msg);
+            debug ("Disabling unattended installation: %s", error.message);
         }
     }
 
diff --git a/src/vm-creator.vala b/src/vm-creator.vala
index 6be3859..3d3d2e5 100644
--- a/src/vm-creator.vala
+++ b/src/vm-creator.vala
@@ -42,14 +42,7 @@ private class Boxes.VMCreator {
 
         string title, name;
         yield create_domain_name_and_title_from_media (out name, out title);
-        try {
-            yield install_media.prepare_for_installation (name, cancellable);
-        } catch (GLib.Error error) {
-            var msg = _("An error occurred during installation preparation. Express Install disabled.");
-            App.app.main_window.notificationbar.display_error (msg);
-            debug("Disabling unattended installation: %s", error.message);
-        }
-
+        yield install_media.prepare_for_installation (name, cancellable);
 
         var volume = yield create_target_volume (name, install_media.resources.storage);
         var config = yield create_domain_config (name, title, volume, cancellable);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]