[gnome-documents] documents: Be more strict about invalid code paths



commit e3f34c8d65fd6820ac67d7e0f5df54db704c6ff5
Author: Debarshi Ray <debarshir gnome org>
Date:   Wed Apr 5 14:04:46 2017 +0200

    documents: Be more strict about invalid code paths
    
    https://bugzilla.gnome.org/show_bug.cgi?id=781532

 src/documents.js |   14 +++++++++-----
 1 files changed, 9 insertions(+), 5 deletions(-)
---
diff --git a/src/documents.js b/src/documents.js
index 4b20db7..fc4258a 100644
--- a/src/documents.js
+++ b/src/documents.js
@@ -447,15 +447,15 @@ const DocCommon = new Lang.Class({
     },
 
     canEdit: function() {
-        log('Error: DocCommon implementations must override canEdit');
+        throw(new Error('DocCommon implementations must override canEdit'));
     },
 
     canShare: function() {
-        log('Error: DocCommon implementations must override canShare');
+        throw(new Error('DocCommon implementations must override canShare'));
     },
 
     canTrash: function() {
-        log('Error: DocCommon implementations must override canTrash');
+        throw(new Error('DocCommon implementations must override canTrash'));
     },
 
     canPrint: function(docModel) {
@@ -476,11 +476,11 @@ const DocCommon = new Lang.Class({
     },
 
     trashImpl: function() {
-        log('Error: DocCommon implementations must override trashImpl');
+        throw(new Error('DocCommon implementations must override trashImpl'));
     },
 
     createThumbnail: function(callback) {
-        log('Error: DocCommon implementations must override createThumbnail');
+        throw(new Error('DocCommon implementations must override createThumbnail'));
     },
 
     refreshIcon: function() {
@@ -886,6 +886,10 @@ const LocalDocument = new Lang.Class({
         this.typeDescription = description;
     },
 
+    downloadImpl: function(localFile, cancellable, callback) {
+        throw(new Error('LocalDocuments need not be downloaded'));
+    },
+
     load: function(passwd, cancellable, callback) {
         Utils.debug('Loading ' + this.__name__ + ' ' + this.id);
         this.loadLocal(passwd, cancellable, callback);


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