[gnome-software/gnome-3-22] snap: Generate correct error for cancelled operations



commit e8c4b263e1f64c6a6d992217e6612e3305a9d0e4
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Oct 27 16:53:47 2017 +1300

    snap: Generate correct error for cancelled operations

 src/plugins/gs-snapd.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-snapd.c b/src/plugins/gs-snapd.c
index 834e105..ebc7775 100644
--- a/src/plugins/gs-snapd.c
+++ b/src/plugins/gs-snapd.c
@@ -753,6 +753,14 @@ send_package_action (const gchar *macaroon,
                        return FALSE;
                }
 
+               if (g_cancellable_is_cancelled (cancellable) && aborted) {
+                       g_set_error (error,
+                                    GS_PLUGIN_ERROR,
+                                    GS_PLUGIN_ERROR_CANCELLED,
+                                    "%s of %s was cancelled", action, name);
+                       return FALSE;
+               }
+
                return TRUE;
        }
 }


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