645 B
645 B
API error handling
All API calls normalize transport and backend failures into ApiError.
- Authenticated HTTP 401: clear the local session through the auth store.
- HTTP 403: keep the session; the caller is authenticated but forbidden/not entitled.
- HTTP 404/409/422: do not retry automatically; render the relevant screen state.
- Network/timeout/429/5xx: keep the session and allow bounded retry/recovery.
- Only a request that actually carried a bearer token can trigger automatic session expiry.
The normalizer accepts both legacy FastAPI string detail responses and the new structured detail: {code, message, context} contract.