From 21650ec3d79c2a94f073589d362461485427b955 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 da6b2262..9b321d09 100644 --- a/rendercv/data_model.py +++ b/rendercv/data_model.py @@ -961,8 +961,9 @@ def check_doi(cls, doi: str) -> str: 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