import Foundation /// Shared heuristic for detecting whether an arbitrary `Error` represents a /// transport-level connectivity failure (vs a logical/server error). Every /// module's `SyncError` previously re-implemented the same lowercase substring /// match — extracted here so there is a single source of truth. public enum SyncConnectionErrorHeuristic { /// Returns `true` when the error's localized description suggests the /// failure is caused by the local network being unable to reach the /// backend (DNS, refused connections, timeouts, unreachable host). public static func isConnectionError(_ error: Error) -> Bool { let msg = error.localizedDescription.lowercased() return msg.contains("network") || msg.contains("connection") || msg.contains("timeout") || msg.contains("unreachable") || msg.contains("could not connect") || msg.contains("offline") } }