Skip to content

Commit 15a92c2

Browse files
committed
chore(poller): log CFWidget 404 headers and body
Add a warning-level diagnostic in fetch_page that, when api.cfwidget.com returns HTTP 404, emits the response headers and body as JSON before raising the usual NEMPException. The body is read inside the response context (the 4xx branch otherwise raises before consuming it). Behavior is otherwise unchanged: the 404 still raises NEMPException.
1 parent e9601a5 commit 15a92c2

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

mod_polling/poller.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,13 @@ async def fetch_page(self, url, timeout=10, decode_json=False, ratelimit=True, *
9595
MAX_FETCH_ATTEMPTS,
9696
)
9797
elif 400 <= response.status < 500:
98+
if response.status == 404 and host == "api.cfwidget.com":
99+
body = await response.text()
100+
logger.warning(
101+
"CFWidget returned HTTP 404 for %s: %s",
102+
url,
103+
json.dumps({"headers": dict(response.headers), "body": body}),
104+
)
98105
raise NEMPException(f"HTTP {response.status} for {url}")
99106
else:
100107
response.raise_for_status()

0 commit comments

Comments
 (0)