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
+8 -3
View File
@@ -20,7 +20,9 @@ goog.require('ol.tilegrid.TileGrid');
ol.tilegrid.WMTS = function(options) {
goog.asserts.assert(
options.resolutions.length == options.matrixIds.length);
options.resolutions.length == options.matrixIds.length,
'options resolutions and matrixIds must have equal length (%s == %s)',
options.resolutions.length, options.matrixIds.length);
/**
* @private
@@ -47,7 +49,8 @@ goog.inherits(ol.tilegrid.WMTS, ol.tilegrid.TileGrid);
* @return {string} MatrixId..
*/
ol.tilegrid.WMTS.prototype.getMatrixId = function(z) {
goog.asserts.assert(0 <= z && z < this.matrixIds_.length);
goog.asserts.assert(0 <= z && z < this.matrixIds_.length,
'attempted to retrive matrixId for illegal z (%s)', z);
return this.matrixIds_[z];
};
@@ -113,7 +116,9 @@ ol.tilegrid.WMTS.createFromCapabilitiesMatrixSet =
metersPerUnit);
var tileWidth = elt[tileWidthPropName];
var tileHeight = elt[tileHeightPropName];
goog.asserts.assert(tileWidth == tileHeight);
goog.asserts.assert(tileWidth == tileHeight,
'square tiles are assumed, tileWidth (%s) == tileHeight (%s)',
tileWidth, tileHeight);
tileSizes.push(tileWidth);
widths.push(elt['MatrixWidth']);
});