From 1bf28e4c5699474d45de8a18b19f1dc787271105 Mon Sep 17 00:00:00 2001 From: Pavlo Malko Date: Thu, 28 Mar 2024 02:15:34 +0200 Subject: [PATCH] Fix catch error on index --- ckanext/spatial/search/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/ckanext/spatial/search/__init__.py b/ckanext/spatial/search/__init__.py index ca6ffce8..59f6d5b6 100644 --- a/ckanext/spatial/search/__init__.py +++ b/ckanext/spatial/search/__init__.py @@ -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 @@ -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