Skip to content

Commit

Permalink
Give ourselves a bit more information to understand HTTP errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jbothma committed Nov 25, 2024
1 parent d404d33 commit 635d194
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions nomenklatura/enrich/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 635d194

Please sign in to comment.