From e9c2f522eccabc77ee980d13cf0f3dec1360a37a Mon Sep 17 00:00:00 2001 From: Rae Knowler Date: Wed, 13 Sep 2023 10:05:18 +0200 Subject: [PATCH] style: Fix bare exceptions --- ckanext/dcatapchharvest/dcat_helpers.py | 4 ++-- ckanext/dcatapchharvest/harvesters.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/ckanext/dcatapchharvest/dcat_helpers.py b/ckanext/dcatapchharvest/dcat_helpers.py index 96bd1bb..f1c9341 100644 --- a/ckanext/dcatapchharvest/dcat_helpers.py +++ b/ckanext/dcatapchharvest/dcat_helpers.py @@ -45,8 +45,8 @@ def uri_to_iri(uri): try: iri = iribaker.to_iri(uri) return iri - except: - raise ValueError("Provided URI can't be converted to IRI") + except Exception as e: + raise ValueError("Provided URI can't be converted to IRI: %s" % e) def get_langs(): diff --git a/ckanext/dcatapchharvest/harvesters.py b/ckanext/dcatapchharvest/harvesters.py index bd34112..b4cfe2b 100644 --- a/ckanext/dcatapchharvest/harvesters.py +++ b/ckanext/dcatapchharvest/harvesters.py @@ -107,8 +107,8 @@ def _get_guid(self, dataset_dict, source_url=None): # noqa log.error(error_msg) self._save_gather_error(error_msg, self.harvest_job) return None - except: - log.exception("An error occured") + except Exception as e: + log.exception("Error when getting identifier: %s" % e) return None return dataset_dict['identifier']