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



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

    snap: Generate correct error for cancelled operations

 plugins/snap/gs-snapd.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/plugins/snap/gs-snapd.c b/plugins/snap/gs-snapd.c
index 022268e..e0d1326 100644
--- a/plugins/snap/gs-snapd.c
+++ b/plugins/snap/gs-snapd.c
@@ -759,6 +759,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]