Add message to assertions.
This commit is contained in:
+11
-5
@@ -61,7 +61,8 @@ ol.structs.RBush.prototype.insert = function(extent, value) {
|
||||
this.rbush_.insert(item);
|
||||
// remember the object that was added to the internal rbush
|
||||
goog.asserts.assert(
|
||||
!goog.object.containsKey(this.items_, goog.getUid(value)));
|
||||
!goog.object.containsKey(this.items_, goog.getUid(value)),
|
||||
'uid (%s) of value (%s) already exists', goog.getUid(value), value);
|
||||
this.items_[goog.getUid(value)] = item;
|
||||
};
|
||||
|
||||
@@ -75,7 +76,9 @@ ol.structs.RBush.prototype.load = function(extents, values) {
|
||||
if (goog.DEBUG && this.readers_) {
|
||||
throw new Error('Can not insert values while reading');
|
||||
}
|
||||
goog.asserts.assert(extents.length === values.length);
|
||||
goog.asserts.assert(extents.length === values.length,
|
||||
'extens and values must have same length (%s === %s)',
|
||||
extents.length, values.length);
|
||||
|
||||
var items = new Array(values.length);
|
||||
for (var i = 0, l = values.length; i < l; i++) {
|
||||
@@ -91,7 +94,8 @@ ol.structs.RBush.prototype.load = function(extents, values) {
|
||||
];
|
||||
items[i] = item;
|
||||
goog.asserts.assert(
|
||||
!goog.object.containsKey(this.items_, goog.getUid(value)));
|
||||
!goog.object.containsKey(this.items_, goog.getUid(value)),
|
||||
'uid (%s) of value (%s) already exists', goog.getUid(value), value);
|
||||
this.items_[goog.getUid(value)] = item;
|
||||
}
|
||||
this.rbush_.load(items);
|
||||
@@ -108,7 +112,8 @@ ol.structs.RBush.prototype.remove = function(value) {
|
||||
throw new Error('Can not remove value while reading');
|
||||
}
|
||||
var uid = goog.getUid(value);
|
||||
goog.asserts.assert(goog.object.containsKey(this.items_, uid));
|
||||
goog.asserts.assert(goog.object.containsKey(this.items_, uid),
|
||||
'uid (%s) of value (%s) does not exist', uid, value);
|
||||
|
||||
// get the object in which the value was wrapped when adding to the
|
||||
// internal rbush. then use that object to do the removal.
|
||||
@@ -125,7 +130,8 @@ ol.structs.RBush.prototype.remove = function(value) {
|
||||
*/
|
||||
ol.structs.RBush.prototype.update = function(extent, value) {
|
||||
var uid = goog.getUid(value);
|
||||
goog.asserts.assert(goog.object.containsKey(this.items_, uid));
|
||||
goog.asserts.assert(goog.object.containsKey(this.items_, uid),
|
||||
'uid (%s) of value (%s) does not exist', uid, value);
|
||||
|
||||
var item = this.items_[uid];
|
||||
if (!ol.extent.equals(item.slice(0, 4), extent)) {
|
||||
|
||||
Reference in New Issue
Block a user