Skip to content

Commit 2dc3ec4

Browse files
committed
Replace LOGGER.error with shared.QuantifyingException for fatal errors
1 parent f6a4a39 commit 2dc3ec4

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

scripts/1-fetch/zenodo_fetch.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -287,11 +287,9 @@ def fetch_zenodo_records(session, page=1, size=100, query="*"):
287287
response.raise_for_status()
288288
return response.json()
289289
except requests.RequestException as e:
290-
LOGGER.error(f"Error fetching Zenodo records: {e}")
291-
raise
290+
raise shared.QuantifyingException(f"Error fetching Zenodo records: {e}")
292291
except json.JSONDecodeError as e:
293-
LOGGER.error(f"Error parsing JSON response: {e}")
294-
raise
292+
raise shared.QuantifyingException(f"Error parsing JSON response: {e}")
295293

296294
def extract_record_info(record_json):
297295
"""
@@ -415,14 +413,12 @@ def main():
415413
session, page=page, size=records_per_page, query=query
416414
)
417415
except (requests.RequestException, json.JSONDecodeError) as e:
418-
LOGGER.error(f"Failed to fetch Zenodo records: {e}")
419-
break
416+
raise shared.QuantifyingException(f"Failed to fetch Zenodo records: {e}")
420417

421418
if not response_data or "hits" not in response_data:
422-
LOGGER.error(
419+
raise shared.QuantifyingException(
423420
"Invalid response from Zenodo REST API - stopping execution"
424421
)
425-
break
426422

427423
hits = response_data["hits"]
428424
records = hits.get("hits", [])

0 commit comments

Comments
 (0)