NexusError
#[non_exhaustive], so include a _ arm - future variants will not break your build.
One mapping for every endpoint
Sync, the write endpoints, AB evaluation, the token exchange and the stream share a single status-to-error mapping, so the same status means the same thing wherever you hit it. No error message ever embeds a response body.Matching
429: quarantine vs rate limit
- Body
{"error":"quarantined","reason":"...","expires_at":"..."}→Quarantined { reason, expires_at }. The SDK pauses syncing untilexpires_at(clamped to 24 hours) on both the background and the read path, and the stream waits it out without counting it as a transport error. - Any other 429 →
RateLimited. Back off before retrying a write.
Reaching the transport error
The HTTP client is an implementation detail, soTransport erases it. Recover the concrete error through the standard error chain:
Configuration errors
What never fails
Cache reads cannot fail on a lock: a panic elsewhere in the process cannot poison the client’s state into permanent unavailability, soget_flag, get_all_configs and friends keep their infallible signatures.
Background errors
Errors on background paths - a failed background sync, a stream disconnect, a refused refresh, a failed file-secret write - are reported throughtracing with structured fields rather than swallowed:
