← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17559: minor change in store, wrap getKeys tx in a try-catch, return no keys if store was not found

 

------------------------------------------------------------
revno: 17559
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2014-11-21 16:13:44 +0700
message:
  minor change in store, wrap getKeys tx in a try-catch, return no keys if store was not found
modified:
  dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js	2013-12-03 13:57:18 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js	2014-11-21 09:13:44 +0000
@@ -283,8 +283,17 @@
             value: function( store ) {
                 var self = this;
                 var deferred = $.Deferred();
+
                 var keys = [];
-                var tx = self._db.transaction( [ store ], "readonly" );
+                var tx;
+
+                try {
+                    tx = self._db.transaction([store], "readonly");
+                } catch(e) {
+                    console.log('Could not find store, returning empty keys.');
+                    deferred.resolveWith(self, []);
+                }
+
                 var objectStore = tx.objectStore( store );
                 var request = objectStore.openCursor();