From d2c37e3476b96164eb0245e0126fbaefe9999691 Mon Sep 17 00:00:00 2001 From: Arbaaz Laskar Date: Wed, 17 Jul 2024 00:33:12 +0530 Subject: [PATCH] refactor: log the url in err.log if API fails to respond with the data --- fichub_cli/utils/fichub.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/fichub_cli/utils/fichub.py b/fichub_cli/utils/fichub.py index c27f550..b04f804 100644 --- a/fichub_cli/utils/fichub.py +++ b/fichub_cli/utils/fichub.py @@ -130,6 +130,9 @@ def get_fic_metadata(self, url: str, format_type: list): # Error: 'epub_url' # Reason: Unsupported URL except (KeyError, UnboundLocalError) as e: + with open("err.log", "a") as file: + file.write(url.strip()+"\n") + if self.debug: logger.error(f"Error: {str(e)} not found!") logger.error(f"GET:Response: {str(self.response)}")