- Initial sync failures - surfaced as exceptions during
APP_INITIALIZER. The Angular bootstrap fails, which is the correct behaviour for a configuration source. - 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 extendNexusError. A single instanceof check covers everything:
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:
- Throws
NexusQuarantinedError(carryingreasonandexpiresAt) fromsync(). - Fires
onQuarantined(reason, expiresAt)on the stream observer (if set). - Suspends
ensureFreshbackground syncing untilexpiresAt. - 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 a5xx status on /sync, the SDK:
-
Catches the response internally and surfaces it as a
NexusServerError(status, bodySnippet). -
Increments an internal attempt counter and schedules a retry via
setTimeoutwith exponential backoff: -
Emits
FALLBACK_REASON_TRANSPORTon the stream observer during the wait. - On the next successful sync - including the auto-retry succeeding - resets the counter.
