Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Log more details on feature processing errors #884

Merged
merged 2 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 + ']';
}

}
Loading