Merge pull request #2884 from tschaub/wkt-returns

Make WKT methods throw errors instead of calling a method that throws.
This commit is contained in:
Tim Schaub
2014-10-27 09:15:20 -06:00
4 changed files with 17 additions and 13 deletions

View File

@@ -345,6 +345,7 @@ def examples_star_json(name, match):
"api", "observable"
],
"compilation_level": "ADVANCED",
"warning_level": "VERBOSE",
"output_wrapper": "// OpenLayers 3. See http://ol3.js.org/\n(function(){%output%})();",
"use_types_for_optimization": True,
"manage_closure_dependencies": True

View File

@@ -68,6 +68,7 @@
"api", "observable"
],
"compilation_level": "ADVANCED",
"warning_level": "VERBOSE",
"output_wrapper": "// OpenLayers 3. See http://ol3js.org/\n(function(){%output%})();",
"use_types_for_optimization": true,
"manage_closure_dependencies": true

View File

@@ -58,6 +58,7 @@
"api", "observable"
],
"compilation_level": "ADVANCED",
"warning_level": "VERBOSE",
"output_wrapper": "(function(){%output%})();",
"use_types_for_optimization": true,
"manage_closure_dependencies": true

View File

@@ -602,7 +602,7 @@ ol.format.WKT.Parser.prototype.parseGeometry_ = function() {
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_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -639,7 +639,7 @@ ol.format.WKT.Parser.prototype.parsePointText_ = function() {
} else if (this.isEmptyGeometry_()) {
return null;
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -656,7 +656,7 @@ ol.format.WKT.Parser.prototype.parseLineStringText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -673,7 +673,7 @@ ol.format.WKT.Parser.prototype.parsePolygonText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -695,7 +695,7 @@ ol.format.WKT.Parser.prototype.parseMultiPointText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -713,7 +713,7 @@ ol.format.WKT.Parser.prototype.parseMultiLineStringText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -730,7 +730,7 @@ ol.format.WKT.Parser.prototype.parseMultiPolygonText_ = function() {
} else if (this.isEmptyGeometry_()) {
return [];
}
this.raiseError_();
throw new Error(this.formatErrorMessage_());
};
@@ -751,7 +751,7 @@ ol.format.WKT.Parser.prototype.parsePoint_ = function() {
if (coordinates.length == this.dimension_) {
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
*/
ol.format.WKT.Parser.prototype.raiseError_ = function() {
throw new Error('Unexpected `' + this.token_.value +
'` at position ' + this.token_.position +
' in `' + this.lexer_.wkt + '`');
ol.format.WKT.Parser.prototype.formatErrorMessage_ = function() {
return 'Unexpected `' + this.token_.value + '` at position ' +
this.token_.position + ' in `' + this.lexer_.wkt + '`';
};