Use ol.error instead of throwing directly.
This commit is contained in:
@@ -3,6 +3,7 @@ goog.provide('ol.geom.Collection');
|
||||
goog.require('goog.array');
|
||||
goog.require('ol.geom.Geometry');
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.base');
|
||||
|
||||
/**
|
||||
* Creates ol.geom.Collection objects.
|
||||
@@ -96,8 +97,9 @@ ol.geom.Collection.prototype.setComponents = function(components) {
|
||||
if (allValidTypes) {
|
||||
this.components_ = components;
|
||||
} else {
|
||||
throw new Error('ol.geom.Collection: at least one component passed to '
|
||||
+ 'setComponents is not allowed.');
|
||||
var msg = 'ol.geom.Collection: at least one component passed to '
|
||||
+ 'setComponents is not allowed.';
|
||||
ol.error(msg);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -111,8 +113,8 @@ ol.geom.Collection.prototype.addComponent = function(component, index) {
|
||||
if (this.isAllowedComponent(component)) {
|
||||
goog.array.insertAt(this.components_, component, index);
|
||||
} else {
|
||||
throw new Error("ol.geom.Collection: The component is not allowed "
|
||||
+ "to be added.");
|
||||
var msg = 'ol.geom.Collection: component is not allowed to be added.';
|
||||
ol.error(msg);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ goog.require('ol.geom.Geometry');
|
||||
|
||||
goog.require('ol.Projection');
|
||||
goog.require('ol.coord.AccessorInterface');
|
||||
goog.require('ol.base');
|
||||
|
||||
/**
|
||||
* Creates ol.geom.Point objects.
|
||||
@@ -135,7 +136,8 @@ ol.geom.Point.prototype._transform = function(proj) {
|
||||
var point = {'x': this.x_, 'y': this.y_};
|
||||
var sourceProj = this.projection_;
|
||||
if (!goog.isDefAndNotNull(sourceProj)) {
|
||||
throw new Error("Cannot transform a point without a source projection.");
|
||||
var msg = 'Cannot transform a point without a source projection.';
|
||||
ol.error(msg);
|
||||
}
|
||||
ol.Projection.transform(point, sourceProj, proj);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user