Skip to content

Commit 3e31dfc

Browse files
abhayrajjais01Siddhesh2377
authored andcommitted
fix(core): catch auth errors to allow offline model discovery (#366)
When the device is offline, setupHTTP/Auth.authenticate throws an error that previously caused completeServicesInitialization to fail entirely. This prevented CppBridge.ModelRegistry.discoverDownloadedModels from running, so already-downloaded models would not appear in the UI. Wrap setupHTTP in a do-catch so that auth failures are logged as warnings while the rest of initialization (C++ state, service bridges, model path setup, and local model discovery) proceeds normally.
1 parent 0a9dede commit 3e31dfc

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

sdk/runanywhere-swift/Sources/RunAnywhere/Public/RunAnywhere.swift

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,14 @@ public enum RunAnywhere {
319319
logger.info("Initializing services for \(environment.description) mode...")
320320

321321
// Step 1: Configure HTTP transport
322-
try await setupHTTP(params: params, environment: environment, logger: logger)
322+
do {
323+
try await setupHTTP(params: params, environment: environment, logger: logger)
324+
} catch {
325+
// If HTTP/auth setup fails (e.g. device is offline), log warning but
326+
// continue initialization so local/cached models remain accessible.
327+
logger.warning("⚠️ HTTP/Auth setup failed (offline?): \(error.localizedDescription)")
328+
logger.info("Continuing SDK init in offline mode – local models will be available")
329+
}
323330

324331
// Step 1.5: Flush any queued telemetry events now that HTTP is configured
325332
// This ensures events queued during initialization are sent

0 commit comments

Comments
 (0)