From 635d1942897597c01807339112604493816638f5 Mon Sep 17 00:00:00 2001 From: JD Bothma Date: Mon, 25 Nov 2024 16:27:25 +0000 Subject: [PATCH] Give ourselves a bit more information to understand HTTP errors --- nomenklatura/enrich/common.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/nomenklatura/enrich/common.py b/nomenklatura/enrich/common.py index be20c42c..0458de8e 100644 --- a/nomenklatura/enrich/common.py +++ b/nomenklatura/enrich/common.py @@ -2,6 +2,7 @@ import json import logging import time +import traceback from banal import as_bool from typing import Union, Any, Dict, Optional, Generator, Generic from abc import ABC, abstractmethod @@ -109,6 +110,7 @@ def http_get_cached( if rex.response is not None and rex.response.status_code in (401, 403): raise EnrichmentAbort("Authorization failure: %s" % url) from rex msg = "HTTP fetch failed [%s]: %s" % (url, rex) + log.info(f"{msg}\n{traceback.format_exc()}") raise EnrichmentException(msg) from rex response = resp.text if cache_days_ > 0: @@ -164,6 +166,7 @@ def http_post_json_cached( "Rate limit exceeded and out of retries: %s" % url ) from rex msg = "HTTP POST failed [%s]: %s" % (url, rex) + log.info(f"{msg}\n{traceback.format_exc()}") raise EnrichmentException(msg) from rex resp_data = resp.json() if cache_days_ > 0: