[grilo] net: Set proper error when operation is cancelled



commit 3c6f1deb3b20c1674a4e7b1ac11a173e6219dbe8
Author: Victor Toso <me victortoso com>
Date:   Tue Mar 29 23:51:31 2016 +0200

    net: Set proper error when operation is cancelled
    
    https://bugzilla.gnome.org/show_bug.cgi?id=764077

 libs/net/grl-net-wc.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)
---
diff --git a/libs/net/grl-net-wc.c b/libs/net/grl-net-wc.c
index 659e4a0..36b2680 100644
--- a/libs/net/grl-net-wc.c
+++ b/libs/net/grl-net-wc.c
@@ -636,9 +636,13 @@ reply_cb (GObject *source,
   GInputStream *in = soup_request_send_finish (rr->request, res, &error);
 
   if (error) {
-    g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
-                                     GRL_NET_WC_ERROR_UNAVAILABLE,
-                                     _("Data not available"));
+    if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) {
+      g_simple_async_result_set_from_error (result, error);
+    } else {
+      g_simple_async_result_set_error (result, GRL_NET_WC_ERROR,
+                                       GRL_NET_WC_ERROR_UNAVAILABLE,
+                                       _("Data not available"));
+    }
     g_error_free (error);
 
     g_simple_async_result_complete (result);


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