Add assert messages for all assertions up until ol.renderer.vector.

This commit is contained in:
Bart van den Eijnden
2015-03-30 16:41:32 +02:00
parent fb9ba22c30
commit 47ce127a10
74 changed files with 1173 additions and 682 deletions
+10 -7
View File
@@ -47,7 +47,7 @@ ol.format.XMLFeature.prototype.readFeature = function(source, opt_options) {
var doc = ol.xml.parse(source);
return this.readFeatureFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
goog.asserts.fail('Unknown source type');
return null;
}
};
@@ -90,7 +90,7 @@ ol.format.XMLFeature.prototype.readFeatures = function(source, opt_options) {
var doc = ol.xml.parse(source);
return this.readFeaturesFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
goog.asserts.fail('Unknown source type');
return [];
}
};
@@ -138,7 +138,7 @@ ol.format.XMLFeature.prototype.readGeometry = function(source, opt_options) {
var doc = ol.xml.parse(source);
return this.readGeometryFromDocument(doc, opt_options);
} else {
goog.asserts.fail();
goog.asserts.fail('Unknown source type');
return null;
}
};
@@ -174,7 +174,7 @@ ol.format.XMLFeature.prototype.readProjection = function(source) {
var doc = ol.xml.parse(source);
return this.readProjectionFromDocument(doc);
} else {
goog.asserts.fail();
goog.asserts.fail('Unknown source type');
return null;
}
};
@@ -205,7 +205,8 @@ ol.format.XMLFeature.prototype.readProjectionFromNode = function(node) {
*/
ol.format.XMLFeature.prototype.writeFeature = function(feature, opt_options) {
var node = this.writeFeatureNode(feature, opt_options);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
'node.nodeType should be ELEMENT');
return goog.dom.xml.serialize(/** @type {Element} */(node));
};
@@ -224,7 +225,8 @@ ol.format.XMLFeature.prototype.writeFeatureNode = goog.abstractMethod;
*/
ol.format.XMLFeature.prototype.writeFeatures = function(features, opt_options) {
var node = this.writeFeaturesNode(features, opt_options);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
'node.nodeType should be ELEMENT');
return goog.dom.xml.serialize(/** @type {Element} */(node));
};
@@ -242,7 +244,8 @@ ol.format.XMLFeature.prototype.writeFeaturesNode = goog.abstractMethod;
*/
ol.format.XMLFeature.prototype.writeGeometry = function(geometry, opt_options) {
var node = this.writeGeometryNode(geometry, opt_options);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT);
goog.asserts.assert(node.nodeType == goog.dom.NodeType.ELEMENT,
'node.nodeType should be ELEMENT');
return goog.dom.xml.serialize(/** @type {Element} */(node));
};