Skip to main content
The SDK distinguishes between two classes of failures:
  1. Initial sync failures - surfaced as exceptions during APP_INITIALIZER. The Angular bootstrap fails, which is the correct behaviour for a configuration source.
  2. Background sync / SSE failures - never thrown. They are logged via NexusLogger.error(...), and the existing cache continues to be served.

Error hierarchy

All SDK errors extend NexusError. A single instanceof check covers everything:
The full hierarchy:

When each is thrown

Catching during an APP_INITIALIZER failure

The default behaviour is to fail the bootstrap. To recover gracefully (e.g. show a degraded UI), you can wrap the bootstrap:

Quarantine handling (v0.4.0+)

When the Nexus backend places a service in quarantine it responds HTTP 429 with a JSON body containing "error":"quarantined", a "reason" string, and an ISO-8601 "expires_at" timestamp. The SDK:
  1. Throws NexusQuarantinedError (carrying reason and expiresAt) from sync().
  2. Fires onQuarantined(reason, expiresAt) on the stream observer (if set).
  3. Suspends ensureFresh background syncing until expiresAt.
  4. On the stream pre-flight, schedules a reconnect after the quarantine window (minimum 5 s) without incrementing the failure counter.

5xx exponential backoff (v0.3.1+)

When the server returns a 5xx status on /sync, the SDK:
  1. Catches the response internally and surfaces it as a NexusServerError(status, bodySnippet).
  2. Increments an internal attempt counter and schedules a retry via setTimeout with exponential backoff:
  3. Emits FALLBACK_REASON_TRANSPORT on the stream observer during the wait.
  4. On the next successful sync - including the auto-retry succeeding - resets the counter.