[gjs] Gio: Don't eat errors when trying to call the initial asyncCallback



commit f2bef7edd6339b42effc845e8f43d26a87bf9d06
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Tue Jul 31 18:20:00 2012 -0300

    Gio: Don't eat errors when trying to call the initial asyncCallback
    
    https://bugzilla.gnome.org/show_bug.cgi?id=682290

 modules/overrides/Gio.js |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/modules/overrides/Gio.js b/modules/overrides/Gio.js
index 8b22913..6251f91 100644
--- a/modules/overrides/Gio.js
+++ b/modules/overrides/Gio.js
@@ -188,11 +188,17 @@ function _makeProxyWrapper(interfaceXml) {
             cancellable = null;
         if (asyncCallback)
             obj.init_async(GLib.PRIORITY_DEFAULT, cancellable, function(initable, result) {
+                let caughtErrorWhenInitting = null;
                 try {
                     initable.init_finish(result);
-                    asyncCallback(initable, null);
                 } catch(e) {
-                    asyncCallback(null, e);
+                    caughtErrorWhenInitting = e;
+                }
+
+                if (caughtErrorWhenInitting === null) {
+                    asyncCallback(initable, null);
+                } else {
+                    asyncCallback(null, caughtErrorWhenInitting);
                 }
             });
         else



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