Skip to content

Commit

Permalink
github: fixed error messages for metadata loading.
Browse files Browse the repository at this point in the history
  • Loading branch information
alejandromumo authored and kpsherva committed Oct 25, 2023
1 parent d78909f commit 98b9388
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions site/zenodo_rdm/github/release.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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):
Expand Down

0 comments on commit 98b9388

Please sign in to comment.