Java Code Examples for org.locationtech.spatial4j.exception.InvalidShapeException#getMessage()

The following examples show how to use org.locationtech.spatial4j.exception.InvalidShapeException#getMessage() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SpatialUtils.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/** Calls {@link #parsePoint(String, org.locationtech.spatial4j.context.SpatialContext)} and wraps
 * the exception with {@link org.apache.solr.common.SolrException} with a helpful message. */
public static Point parsePointSolrException(String externalVal, SpatialContext ctx) throws SolrException {
  try {
    return parsePoint(externalVal, ctx);
  } catch (InvalidShapeException e) {
    String message = e.getMessage();
    if (!message.contains(externalVal))
      message = "Can't parse point '" + externalVal + "' because: " + message;
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, message, e);
  }
}
 
Example 2
Source File: SpatialUtils.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
/**
 * Calls {@link #parseRectangle(String, org.locationtech.spatial4j.context.SpatialContext)} and wraps the exception with
 * {@link org.apache.solr.common.SolrException} with a helpful message.
 */
public static Rectangle parseRectangeSolrException(String externalVal, SpatialContext ctx) throws SolrException {
  try {
    return parseRectangle(externalVal, ctx);
  } catch (InvalidShapeException e) {
    String message = e.getMessage();
    if (!message.contains(externalVal))
      message = "Can't parse rectangle '" + externalVal + "' because: " + message;
    throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, message, e);
  }
}