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