Add message to assertions.

This commit is contained in:
Marc Jansen
2015-03-30 22:50:15 +02:00
parent 2c40d74a15
commit fb9ba22c30
45 changed files with 394 additions and 221 deletions
+9 -5
View File
@@ -102,7 +102,8 @@ ol.style.AtlasManager.prototype.getInfo = function(id) {
}
/** @type {?ol.style.AtlasInfo} */
var hitInfo = this.getInfo_(this.hitAtlases_, id);
goog.asserts.assert(!goog.isNull(hitInfo));
goog.asserts.assert(!goog.isNull(hitInfo),
'hitInfo must not be null');
return this.mergeInfos_(info, hitInfo);
};
@@ -137,8 +138,10 @@ ol.style.AtlasManager.prototype.getInfo_ = function(atlases, id) {
* entry, or `null` if the entry is not part of the atlases.
*/
ol.style.AtlasManager.prototype.mergeInfos_ = function(info, hitInfo) {
goog.asserts.assert(info.offsetX === hitInfo.offsetX);
goog.asserts.assert(info.offsetY === hitInfo.offsetY);
goog.asserts.assert(info.offsetX === hitInfo.offsetX,
'in order to merge, offsetX of info and hitInfo must be equal');
goog.asserts.assert(info.offsetY === hitInfo.offsetY,
'in order to merge, offsetY of info and hitInfo must be equal');
return /** @type {ol.style.AtlasManagerInfo} */ ({
offsetX: info.offsetX,
offsetY: info.offsetY,
@@ -194,7 +197,8 @@ ol.style.AtlasManager.prototype.add =
/** @type {?ol.style.AtlasInfo} */
var hitInfo = this.add_(true,
id, width, height, renderHitCallback, opt_this);
goog.asserts.assert(!goog.isNull(hitInfo));
goog.asserts.assert(!goog.isNull(hitInfo),
'hitInfo must not be null');
return this.mergeInfos_(info, hitInfo);
};
@@ -240,7 +244,7 @@ ol.style.AtlasManager.prototype.add_ =
++ii;
}
}
goog.asserts.fail();
goog.asserts.fail('Failed to add to atlasmanager');
};