From b1cf76c02dfdf80a430214423e7886af462648f7 Mon Sep 17 00:00:00 2001 From: Inferencebot Date: Fri, 13 Nov 2026 22:46:50 +0000 Subject: [PATCH] portal errors keep their own status instead of becoming 502 portal_post collapsed every non-2xx upstream response into HTTPException(502), so a plain rate limit ("Too many requests. Slow down.") reached the operator as "Could not send guest access (502)": a gateway failure, for a condition that clears in a minute and whose message said exactly that. The status now passes through, so a 429 arrives as a 429 with the portal's own words. --- app/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/main.py b/app/main.py index be07a48..592b348 100644 --- a/app/main.py +++ b/app/main.py @@ -85,7 +85,11 @@ async def portal_post(path: str, payload: dict) -> dict: detail = r.json().get("detail", r.text) except Exception: detail = r.text - raise HTTPException(502, f"Portal error {r.status_code}: {detail}") + # Pass the portal's OWN status through. Collapsing every upstream failure + # into 502 turned a plain rate limit ("Too many requests. Slow down.") + # into "Could not send guest access (502)" — a gateway error the operator + # cannot act on, for a condition that clears in a minute and says so. + raise HTTPException(r.status_code, f"Portal error {r.status_code}: {detail}") return r.json()