[gnome-documents] error: handle CANCELLED errors directly in ErrorHandler



commit be12879614527ffbe3016e6c65e984bfdd0febda
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Mon Oct 31 15:37:54 2011 -0400

    error: handle CANCELLED errors directly in ErrorHandler
    
    Instead of special-casing them in the view.

 src/embed.js |    4 ----
 src/error.js |   10 +++++++++-
 2 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/embed.js b/src/embed.js
index aeb6945..df8f1a4 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -347,10 +347,6 @@ ViewEmbed.prototype  = {
         }
 
         this._loaderCancellable = null;
-        // FIXME: we need support for error codes in GJS
-        if (exception.toString().indexOf('Operation was cancelled') != -1)
-            return;
-
         Global.modeController.setWindowMode(WindowMode.WindowMode.PREVIEW);
 
         let errorBox = new ErrorBox.ErrorBox(message, exception.message);
diff --git a/src/error.js b/src/error.js
index 9b89650..694538b 100644
--- a/src/error.js
+++ b/src/error.js
@@ -35,6 +35,11 @@ ErrorHandler.prototype = {
     addLoadError: function(doc, exception) {
         // Translators: %s is the title of a document
         let message = _("Unable to load \"%s\" for preview").format(doc.title);
+
+        // FIXME: we need support for error codes in GJS
+        if (exception.toString().indexOf('Operation was cancelled') != -1)
+            return;
+
         log('Error caught: ' + message + ' - ' + exception.message);
 
         this.emit('load-error', message, exception);
@@ -42,7 +47,10 @@ ErrorHandler.prototype = {
 
     addQueryError: function(exception) {
         let message = _("Unable to fetch the list of documents");
-        log('Error caught: ' + message + ' - ' + exception.message);
+
+        // FIXME: we need support for error codes in GJS
+        if (exception.toString().indexOf('Operation was cancelled') != -1)
+            return;
 
         this.emit('query-error', message, exception);
     }



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