Skip to content

Commit

Permalink
Log more details on feature processing errors (#884)
Browse files Browse the repository at this point in the history
  • Loading branch information
msbarry authored May 7, 2024
1 parent e6e2f46 commit 8f9b750
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public Feature point(String layer) {
}
return geometry(layer, source.worldGeometry());
} catch (GeometryException e) {
e.log(stats, "feature_point", "Error getting point geometry for " + source.id());
e.log(stats, "feature_point", "Error getting point geometry for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -100,7 +100,7 @@ public Feature line(String layer) {
try {
return geometry(layer, source.line());
} catch (GeometryException e) {
e.log(stats, "feature_line", "Error constructing line for " + source.id());
e.log(stats, "feature_line", "Error constructing line for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -120,7 +120,7 @@ public Feature polygon(String layer) {
try {
return geometry(layer, source.polygon());
} catch (GeometryException e) {
e.log(stats, "feature_polygon", "Error constructing polygon for " + source.id());
e.log(stats, "feature_polygon", "Error constructing polygon for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -135,7 +135,7 @@ public Feature centroid(String layer) {
try {
return geometry(layer, source.centroid());
} catch (GeometryException e) {
e.log(stats, "feature_centroid", "Error getting centroid for " + source.id());
e.log(stats, "feature_centroid", "Error getting centroid for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -152,7 +152,7 @@ public Feature centroidIfConvex(String layer) {
try {
return geometry(layer, source.centroidIfConvex());
} catch (GeometryException e) {
e.log(stats, "feature_centroid_if_convex", "Error constructing centroid if convex for " + source.id());
e.log(stats, "feature_centroid_if_convex", "Error constructing centroid if convex for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -168,7 +168,7 @@ public Feature pointOnSurface(String layer) {
try {
return geometry(layer, source.pointOnSurface());
} catch (GeometryException e) {
e.log(stats, "feature_point_on_surface", "Error constructing point on surface for " + source.id());
e.log(stats, "feature_point_on_surface", "Error constructing point on surface for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -190,7 +190,7 @@ public Feature innermostPoint(String layer, double tolerance) {
try {
return geometry(layer, source.innermostPoint(tolerance));
} catch (GeometryException e) {
e.log(stats, "feature_innermost_point", "Error constructing innermost point for " + source.id());
e.log(stats, "feature_innermost_point", "Error constructing innermost point for " + source);
return new Feature(layer, EMPTY_GEOM, source.id());
}
}
Expand All @@ -205,7 +205,7 @@ public int getMinZoomForPixelSize(double pixelSize) {
try {
return GeoUtils.minZoomForPixelSize(source.size(), pixelSize);
} catch (GeometryException e) {
e.log(stats, "min_zoom_for_size_failure", "Error getting min zoom for size from geometry " + source.id());
e.log(stats, "min_zoom_for_size_failure", "Error getting min zoom for size from geometry " + source);
return config.maxzoom();
}
}
Expand All @@ -217,7 +217,7 @@ public double getPixelSizeAtZoom(int zoom) {
return source.size() * (256 << zoom);
} catch (GeometryException e) {
e.log(stats, "source_feature_pixel_size_at_zoom_failure",
"Error getting source feature pixel size at zoom from geometry " + source.id());
"Error getting source feature pixel size at zoom from geometry " + source);
return 0;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,10 @@ public int hashCode() {

@Override
public String toString() {
return "SimpleFeature[" +
"geometry type=" + latLonGeometry().getGeometryType() + ", " +
"tags=" + tags + ']';
return "Feature[source=" + getSource() +
", source layer=" + getSourceLayer() +
", id=" + id() +
", geometry type=" + latLonGeometry().getGeometryType() +
", tags=" + tags + ']';
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -325,4 +325,12 @@ public boolean hasRelationInfo() {
return relationInfos != null && !relationInfos.isEmpty();
}

@Override
public String toString() {
return "Feature[source=" + getSource() +
", source layer=" + getSourceLayer() +
", id=" + id() +
", tags=" + tags + ']';
}

}

0 comments on commit 8f9b750

Please sign in to comment.