From df3af62cfa2ec8b76e9c307fdb7c0c7dc17f0df5 Mon Sep 17 00:00:00 2001 From: Francesco Frassinelli Date: Fri, 18 Feb 2022 10:38:31 +0100 Subject: [PATCH] Handle shape(...) exceptions --- ckanext/spatial/plugin/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ckanext/spatial/plugin/__init__.py b/ckanext/spatial/plugin/__init__.py index 361d1e5..c47d555 100644 --- a/ckanext/spatial/plugin/__init__.py +++ b/ckanext/spatial/plugin/__init__.py @@ -135,8 +135,8 @@ class SpatialMetadata(p.SingletonPlugin): try: save_package_extent(package.id,geometry) - except ValueError as e: - error_dict = {'spatial':[u'Error creating geometry: %s' % six.text_type(e)]} + except AttributeError as e: + error_dict = {'spatial':[u'Error creating geometry: invalid GeoJSON']} raise tk.ValidationError(error_dict, error_summary=package_error_summary(error_dict)) except Exception as e: if bool(os.getenv('DEBUG')):