Raise error only if status code is 404

This commit is contained in:
LabAsim 2023-10-28 22:11:21 +03:00
parent 270479857d
commit 19d9036ce9
1 changed files with 3 additions and 2 deletions

View File

@ -961,7 +961,8 @@ class PublicationEntry(Event):
try: try:
urllib.request.urlopen(doi_url) urllib.request.urlopen(doi_url)
except urllib.request.HTTPError: except urllib.request.HTTPError as err:
if err.code == 404:
raise ValueError(f"{doi} cannot be found in the DOI System 🤖") raise ValueError(f"{doi} cannot be found in the DOI System 🤖")
return doi return doi