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

Fix catch error on index #327

Merged
merged 1 commit into from
Jun 26, 2024
Merged
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
5 changes: 3 additions & 2 deletions ckanext/spatial/search/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@

try:
from shapely.errors import GeometryTypeError
GeometryError = (GeometryTypeError, TypeError)
except ImportError:
# Previous version of shapely uses ValueError and TypeError
GeometryTypeError = (ValueError, TypeError)
GeometryError = (ValueError, TypeError)

from ckantoolkit import config, asbool
from ckanext.spatial.lib import normalize_bbox, fit_bbox, fit_linear_ring
Expand Down Expand Up @@ -35,7 +36,7 @@ def parse_geojson(self, geom_from_metadata):
def shape_from_geometry(self, geometry):
try:
shape = shapely.geometry.shape(geometry)
except GeometryTypeError as e:
except GeometryError as e:
log.error("{}, not indexing :: {}".format(e, json.dumps(geometry)[:100]))
return None

Expand Down