Skip to main content

NexusError

The enum is #[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 until expires_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, so Transport erases it. Recover the concrete error through the standard error chain:

Configuration errors

Rejections happen once, at construction, and name the option. See Configuration for the full list of rejected values.

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, so get_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 through tracing with structured fields rather than swallowed:
No span field or event ever carries a secret value, a secret key name, an API key, a session JWT or a workload OIDC token.