Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix fail not proper error message handling #minor #70

Merged
merged 1 commit into from
Sep 19, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion sda_orchestrator/utils/id_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ async def create_draft_doi(self, user: str, inbox_path: str) -> Union[Dict, None
"dataset": f"{self.ns_url}/{_suffix.lower()}",
}
else:
LOG.debug(f"DOI draft created and response was: {response}")
LOG.error(f"DOI API create draft request failed with code: {response.status_code}")
doi_data = self._check_errors(response, doi_suffix)

Expand Down Expand Up @@ -182,7 +183,7 @@ def _check_errors(self, response: Response, doi_suffix: str) -> Union[Dict, None
doi_data = None
if len(errors_resp) == 1:
error_msg = errors_resp[0]["title"] if "title" in errors_resp[0] else errors_resp[0]["detail"]
if errors_resp[0]["source"] == "doi" and error_msg == "This DOI has already been taken":
if "source" in errors_resp[0] and error_msg == "This DOI has already been taken":
LOG.info("DOI already taken, we will associate the submission to this doi dataset.")
doi_data = {
"suffix": doi_suffix,
Expand Down