Skip to content

Commit

Permalink
Fix catch error on index
Browse files Browse the repository at this point in the history
  • Loading branch information
PavloMalko authored and benjwadams committed Jun 26, 2024
1 parent 931074c commit 5ffcba4
Showing 1 changed file with 3 additions and 2 deletions.
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

0 comments on commit 5ffcba4

Please sign in to comment.