From 19d9036ce9c837db2ee236691e18c9054274f875 Mon Sep 17 00:00:00 2001 From: LabAsim Date: Sat, 28 Oct 2023 22:11:21 +0300 Subject: [PATCH] Raise error only if status code is 404 --- rendercv/data_model.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/rendercv/data_model.py b/rendercv/data_model.py index da6b226..9b321d0 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -961,8 +961,9 @@ class PublicationEntry(Event): try: urllib.request.urlopen(doi_url) - except urllib.request.HTTPError: - raise ValueError(f"{doi} cannot be found in the DOI System 🤖") + except urllib.request.HTTPError as err: + if err.code == 404: + raise ValueError(f"{doi} cannot be found in the DOI System 🤖") return doi