[gnome-builder] flatpak: be tolerant of flatpak installation errors



commit a5983bb27240b0ac0cb744ac9fa1a18dbfdefa7e
Author: Christian Hergert <chergert redhat com>
Date:   Thu Sep 22 01:25:48 2016 -0700

    flatpak: be tolerant of flatpak installation errors
    
    If we come across an error loading a FlatpakInstallation, we can still make
    progress with another installation dir. So don't bail early before we
    make additional progress.
    
    Also, we can just return an empty array in the failure case, no need to
    propagate the error.

 plugins/flatpak/gbp-flatpak-runtime-provider.c |   18 ++++++++----------
 1 files changed, 8 insertions(+), 10 deletions(-)
---
diff --git a/plugins/flatpak/gbp-flatpak-runtime-provider.c b/plugins/flatpak/gbp-flatpak-runtime-provider.c
index cf54508..82652f1 100644
--- a/plugins/flatpak/gbp-flatpak-runtime-provider.c
+++ b/plugins/flatpak/gbp-flatpak-runtime-provider.c
@@ -200,25 +200,23 @@ gbp_flatpak_runtime_provider_load_worker (GTask        *task,
 
   ret = g_ptr_array_new_with_free_func (g_object_unref);
 
-  if (NULL == (self->system_installation = flatpak_installation_new_system (cancellable, &error)))
+  if (NULL == (self->system_installation = flatpak_installation_new_system (cancellable, &error)) ||
+      !gbp_flatpak_runtime_provider_load_refs (self, self->system_installation, ret, cancellable, &error))
     {
-      g_task_return_error (task, error);
-      IDE_EXIT;
+      g_warning ("Failed to load system installation: %s", error->message);
+      g_clear_error (&error);
     }
 
-  gbp_flatpak_runtime_provider_load_refs (self, self->system_installation, ret, cancellable, &error);
-
   path = g_build_filename (g_get_home_dir (), ".local", "share", "flatpak", NULL);
   file = g_file_new_for_path (path);
 
-  if (NULL == (self->user_installation = flatpak_installation_new_for_path (file, TRUE, cancellable, 
&error)))
+  if (NULL == (self->user_installation = flatpak_installation_new_for_path (file, TRUE, cancellable, 
&error)) ||
+      !gbp_flatpak_runtime_provider_load_refs (self, self->user_installation, ret, cancellable, &error))
     {
-      g_task_return_error (task, error);
-      IDE_EXIT;
+      g_warning ("%s", error->message);
+      g_clear_error (&error);
     }
 
-  gbp_flatpak_runtime_provider_load_refs (self, self->user_installation, ret, cancellable, &error);
-
   g_task_return_pointer (task, g_steal_pointer (&ret), (GDestroyNotify)g_ptr_array_unref);
 
   IDE_EXIT;


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