Throw instead of calling a function that throws
This commit is contained in:
+14
-13
@@ -602,7 +602,7 @@ ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
|
|||||||
return new ctor(coordinates);
|
return new ctor(coordinates);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ ol.format.WKT.Parser.prototype.parseGeometryCollectionText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -639,7 +639,7 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -656,7 +656,7 @@ ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -673,7 +673,7 @@ ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -695,7 +695,7 @@ ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -713,7 +713,7 @@ ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -730,7 +730,7 @@ ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
|
|||||||
} else if (this.isEmptyGeometry_()) {
|
} else if (this.isEmptyGeometry_()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -751,7 +751,7 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
|
|||||||
if (coordinates.length == this.dimension_) {
|
if (coordinates.length == this.dimension_) {
|
||||||
return coordinates;
|
return coordinates;
|
||||||
}
|
}
|
||||||
this.raiseError_();
|
throw new Error(this.formatErrorMessage_());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -822,12 +822,13 @@ ol.format.WKT.Parser.prototype.isEmptyGeometry_ = function() {
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Create an error message for an unexpected token error.
|
||||||
|
* @return {string} Error message.
|
||||||
* @private
|
* @private
|
||||||
*/
|
*/
|
||||||
ol.format.WKT.Parser.prototype.raiseError_ = function() {
|
ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
|
||||||
throw new Error('Unexpected `' + this.token_.value +
|
return 'Unexpected `' + this.token_.value + '` at position ' +
|
||||||
'` at position ' + this.token_.position +
|
this.token_.position + ' in `' + this.lexer_.wkt + '`';
|
||||||
' in `' + this.lexer_.wkt + '`');
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user