From 98b9388833997ca296cceea773933bf7ffc64064 Mon Sep 17 00:00:00 2001 From: alejandromumo Date: Wed, 25 Oct 2023 10:33:52 +0200 Subject: [PATCH] github: fixed error messages for metadata loading. --- site/zenodo_rdm/github/release.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/site/zenodo_rdm/github/release.py b/site/zenodo_rdm/github/release.py index 7ad2a29f..b1dff64a 100644 --- a/site/zenodo_rdm/github/release.py +++ b/site/zenodo_rdm/github/release.py @@ -34,7 +34,7 @@ def load_extra_metadata(self): except Exception as exc: current_app.logger.exception(str(exc)) raise CustomGitHubMetadataError( - f"Extra metadata failed for file {zenodo_json_file_name}" + file=zenodo_json_file_name, message="Extra metadata load failed." ) def load_citation_metadata(self, data): @@ -46,13 +46,19 @@ def load_citation_metadata(self, data): if not data: return {} + citation_file_name = current_app.config.get( + "GITHUB_CITATION_FILE", "CITATION.cff" + ) + try: legacy_data = {"metadata": CitationMetadataSchema().load(data)} rdm_data = LegacySchema().load(legacy_data) return rdm_data["metadata"] except Exception as exc: current_app.logger.exception(str(exc)) - raise CustomGitHubMetadataError(f"Citation metadata serialization failed") + raise CustomGitHubMetadataError( + file=citation_file_name, message="Citation metadata load failed" + ) class ZenodoGithubRelease(RDMGithubRelease):