From bd77148bef39829350670856706b48ad35837df1 Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Mon, 25 Sep 2023 10:11:28 +0300 Subject: Improve http error logging --- plugins/ScraperSourcePlugin.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugins/ScraperSourcePlugin.py') diff --git a/plugins/ScraperSourcePlugin.py b/plugins/ScraperSourcePlugin.py index eb5e526..dd7e757 100644 --- a/plugins/ScraperSourcePlugin.py +++ b/plugins/ScraperSourcePlugin.py @@ -53,7 +53,9 @@ class Plugin(PluginInterface): try: resp = session.get(url, allow_redirects=True) if resp.status_code >= 400: - raise Exception("status_code >= 400") + ex = Exception(f"status_code >= 400, got {resp.status_code}") + ex.add_note(resp.text[0:1000]) + raise ex except Exception as ex: ex.add_note(f"{self.log_prefix} failed to fetch page, url: {url}") raise -- cgit v1.3