fix: improve fetch_remote error handling and diagnostics
- Add _log.warning() to bare except clause in fetch_remote so unexpected errors (JSON parse failures, AttributeError, etc.) leave a diagnostic trail instead of silently surfacing as 'unreachable' - Map HTTPStatusError (non-401/403 HTTP errors like 500, 503, 429) to 'unreachable' instead of 'auth_failed' — semantically correct since these are connectivity/server errors, not authentication failures - Fix stale task comment in test_api.py: task-8 → task-5
This commit is contained in:
+3
-2
@@ -946,12 +946,13 @@ async def federation_sessions(request: Request) -> list[dict]:
|
|||||||
except httpx.HTTPStatusError:
|
except httpx.HTTPStatusError:
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"status": "auth_failed",
|
"status": "unreachable",
|
||||||
"remoteId": remote_id,
|
"remoteId": remote_id,
|
||||||
"deviceName": remote_name,
|
"deviceName": remote_name,
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
except Exception:
|
except Exception as exc:
|
||||||
|
_log.warning("Unexpected error fetching remote %s: %s", url, exc)
|
||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
"status": "unreachable",
|
"status": "unreachable",
|
||||||
|
|||||||
@@ -1602,7 +1602,7 @@ def test_federation_client_exists_on_app_state(monkeypatch):
|
|||||||
|
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
# GET /api/federation/sessions (task-8)
|
# GET /api/federation/sessions (task-5)
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user