From 362868dfdecc30727610f8e9e2de292cbdc8e5c1 Mon Sep 17 00:00:00 2001 From: Fuhu Xia Date: Tue, 14 Nov 2023 20:06:39 -0500 Subject: [PATCH] handle GeoJSON error instead of crashing fetch consumer --- ckanext/datajson/datajson.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/ckanext/datajson/datajson.py b/ckanext/datajson/datajson.py index 26c0dcad..b37b3d1b 100644 --- a/ckanext/datajson/datajson.py +++ b/ckanext/datajson/datajson.py @@ -814,6 +814,10 @@ def import_stage(self, harvest_object): pkg['name'] = self.make_package_name(dataset_processed["title"], harvest_object.guid) pkg = get_action('package_create')(self.context(), pkg) log.warn('created package %s (%s) from %s' % (pkg["name"], pkg["id"], harvest_object.source.url)) + except ValidationError as e: + log.error('Failed to create package %s: %s' % (pkg["name"], str(e))) + self._save_object_error('Error creating package: %s' % (e), harvest_object, 'Import') + return None except Exception as e: log.error('Failed to create package %s from %s\n\t%s\n\t%s' % (pkg["name"], harvest_object.source.url,