dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23991
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11709: minor exception string fixes to js storage
------------------------------------------------------------
revno: 11709
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2013-08-20 09:37:08 +0200
message:
minor exception string fixes to js storage
modified:
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.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ls.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js
dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.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-08-19 16:01:56 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.idb.js 2013-08-20 07:37:08 +0000
@@ -116,11 +116,11 @@
var deferred = $.Deferred();
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( dhis2.storage.DATABASE_IS_NOT_OPEN );
}
if( typeof object === 'undefined' || typeof object[self.keyPath] === 'undefined' ) {
- throw new Error( 'Invalid object' );
+ throw new Error( dhis2.storage.INVALID_OBJECT );
}
object = JSON.parse( JSON.stringify( object ) );
@@ -151,37 +151,37 @@
enumerable: true
},
/*
- 'setAll': {
- value: function( store, arr ) {
- var self = this;
- var deferred1 = $.Deferred();
- var deferred2 = $.Deferred();
- var chained = deferred2.promise();
-
- $.each( arr, function( idx, item ) {
- chained = chained.then( function() {
- return self.set( store, item );
- } );
- } );
-
- chained = chained.then( function() {
- deferred1.resolveWith( this );
- } );
-
- deferred2.resolve();
-
- return deferred1.promise();
- },
- enumerable: true
- },
- */
+ 'setAll': {
+ value: function( store, arr ) {
+ var self = this;
+ var deferred1 = $.Deferred();
+ var deferred2 = $.Deferred();
+ var chained = deferred2.promise();
+
+ $.each( arr, function( idx, item ) {
+ chained = chained.then( function() {
+ return self.set( store, item );
+ } );
+ } );
+
+ chained = chained.then( function() {
+ deferred1.resolveWith( this );
+ } );
+
+ deferred2.resolve();
+
+ return deferred1.promise();
+ },
+ enumerable: true
+ },
+ */
'setAll': {
value: function( store, arr ) {
var self = this;
var deferred = $.Deferred();
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( dhis2.storage.DATABASE_IS_NOT_OPEN );
}
var storedCount = 0;
@@ -195,7 +195,7 @@
object = JSON.parse( JSON.stringify( object ) );
if( typeof object === 'undefined' || typeof object[self.keyPath] === 'undefined' ) {
- throw new Error( 'Invalid object' );
+ throw new Error( dhis2.storage.INVALID_OBJECT );
}
var key = object[self.keyPath];
@@ -221,11 +221,11 @@
var self = this;
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( dhis2.storage.DATABASE_IS_NOT_OPEN );
}
if( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY );
}
var tx = self._db.transaction( [ store ], "readonly" );
@@ -343,11 +343,11 @@
var self = this;
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( dhis2.storage.DATABASE_IS_NOT_OPEN );
}
if( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY );
}
var tx = self._db.transaction( [ store ], "readwrite" );
@@ -379,7 +379,7 @@
var self = this;
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( DATABASE_IS_NOT_OPEN );
}
var tx = self._db.transaction( [ store ], "readwrite" );
@@ -411,11 +411,11 @@
var self = this;
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( dhis2.storage.DATABASE_IS_NOT_OPEN );
}
if( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY );
}
var tx = self._db.transaction( [ store ], "readonly" );
@@ -447,7 +447,7 @@
var self = this;
if( typeof self._db === 'undefined' ) {
- throw new Error( 'Database is not open.' );
+ throw new Error( dhis2.storage.DATABASE_IS_NOT_OPEN );
}
if( typeof key === 'undefined' ) {
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.js 2013-08-14 07:16:53 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.js 2013-08-20 07:37:08 +0000
@@ -29,6 +29,10 @@
dhis2.util.namespace( 'dhis2.storage' );
+dhis2.storage.DATABASE_IS_NOT_OPEN = "Database is not open, please call .open() on your store before using it.";
+dhis2.storage.INVALID_KEY = "No valid key was provided.";
+dhis2.storage.INVALID_OBJECT = "No valid object was provided";
+
dhis2.storage.Store = function( options ) {
var self = this;
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ls.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ls.js 2013-08-05 07:09:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ls.js 2013-08-20 07:37:08 +0000
@@ -130,7 +130,7 @@
var self = this;
if ( typeof object === 'undefined' || typeof object[self.keyPath] === 'undefined' ) {
- throw new Error( 'Invalid object' );
+ throw new Error( dhis2.storage.INVALID_OBJECT );
}
object = JSON.parse( JSON.stringify( object ) );
@@ -177,7 +177,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
var deferred = $.Deferred();
@@ -240,7 +240,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
var deferred = $.Deferred();
@@ -276,7 +276,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
key = this.name + '.' + store + '.' + key;
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js 2013-08-05 07:09:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.memory.js 2013-08-20 07:37:08 +0000
@@ -130,7 +130,7 @@
var self = this;
if ( typeof object === 'undefined' || typeof object[self.keyPath] === 'undefined' ) {
- throw new Error( 'Invalid object' );
+ throw new Error( dhis2.storage.INVALID_OBJECT );
}
object = JSON.parse( JSON.stringify( object ) );
@@ -177,7 +177,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
var deferred = $.Deferred();
@@ -240,7 +240,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
var deferred = $.Deferred();
@@ -276,7 +276,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
key = this.name + '.' + store + '.' + key;
=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js'
--- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js 2013-08-05 07:09:17 +0000
+++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/dhis2/dhis2.storage.ss.js 2013-08-20 07:37:08 +0000
@@ -132,7 +132,7 @@
var self = this;
if ( typeof object === 'undefined' || typeof object[self.keyPath] === 'undefined' ) {
- throw new Error( 'Invalid object' );
+ throw new Error( dhis2.storage.INVALID_OBJECT );
}
object = JSON.parse( JSON.stringify( object ) );
@@ -179,7 +179,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
var deferred = $.Deferred();
@@ -242,7 +242,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
var deferred = $.Deferred();
@@ -278,7 +278,7 @@
var self = this;
if ( typeof key === 'undefined' ) {
- throw new Error( 'Invalid key: ', key );
+ throw new Error( dhis2.storage.INVALID_KEY, key );
}
key = this.name + '.' + store + '.' + key;