Skip to content

Commit

Permalink
Merge pull request ckan#327 from PavloMalko/fix-error-index
Browse files Browse the repository at this point in the history
Fix catch error on index
  • Loading branch information
amercader authored Jun 26, 2024
2 parents 9383084 + 1bf28e4 commit 237d033
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 237d033

Please sign in to comment.