[gnome-books/wip/hadess/more-dead-code-cleanup] documents: Don't print warnings for missing document



commit 7c6adca65435eaf8d5957a80a45087c52fc9eaa5
Author: Bastien Nocera <hadess hadess net>
Date:   Thu Jan 31 11:06:10 2019 +0100

    documents: Don't print warnings for missing document
    
    Don't print warnings when Tracker lists a file that's missing from the
    disk, either when trying to fetch info about it, or when trying to open
    it. The error page when opening it should be enough.

 src/documents.js | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 8fa8cc82..0a0c6f7e 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -525,7 +525,10 @@ const DocCommon = new Lang.Class({
         try {
             info = object.query_info_finish(res);
         } catch (e) {
-            logError(e, 'Unable to query info for file at ' + this.uri);
+            if (!e.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
+                logError(e, 'Unable to query info for file at ' + this.uri);
+            else
+                Utils.debug('Unable to query info for file at ' + this.uri);
             this._failedThumbnailing = true;
             return;
         }
@@ -1086,7 +1089,10 @@ var DocumentManager = new Lang.Class({
             return;
         }
 
-        logError(error, 'Unable to load document');
+        if (!error.matches(Gio.IOErrorEnum, Gio.IOErrorEnum.NOT_FOUND))
+            logError(error, 'Unable to load document');
+        else
+            Utils.debug('Unable to load document' + doc.uri);
 
         // Translators: %s is the title of a document
         let message = _("Oops! Unable to load ā€œ%sā€").format(doc.name);


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