Skip to content

Commit 779d380

Browse files
Use preconditionFailure for ably-cocoa compatibility guards
Replace fatalError with preconditionFailure and add comments noting that these are fallbacks which our ably-cocoa dependency version should ensure are never triggered. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3e9ba05 commit 779d380

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

Sources/AblyLiveObjects/Internal/DefaultInternalPlugin.swift

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,9 @@ internal final class DefaultInternalPlugin: NSObject, _AblyPluginSupportPrivate.
161161
return nil
162162
}
163163

164+
// This is a fallback; our ably-cocoa dependency version should ensure that this is never triggered.
164165
guard (connectionDetails as AnyObject).responds(to: #selector(ConnectionDetailsProtocol.siteCode)) else {
165-
fatalError("ably-cocoa's connectionDetails does not implement siteCode. Please update ably-cocoa to a version that supports apply-on-ACK.")
166+
preconditionFailure("ably-cocoa's connectionDetails does not implement siteCode. Please update ably-cocoa to a version that supports apply-on-ACK.")
166167
}
167168

168169
return connectionDetails.siteCode?()
@@ -182,8 +183,9 @@ internal final class DefaultInternalPlugin: NSObject, _AblyPluginSupportPrivate.
182183
let objectMessageBoxes: [ObjectMessageBox<OutboundObjectMessage>] = objectMessages.map { .init(objectMessage: $0) }
183184
let internalQueue = pluginAPI.internalQueue(for: client)
184185

186+
// This is a fallback; our ably-cocoa dependency version should ensure that this is never triggered.
185187
guard (pluginAPI as AnyObject).responds(to: #selector(PluginAPIProtocol.nosync_sendObject(withObjectMessages:channel:completionWithResult:))) else {
186-
fatalError("ably-cocoa does not implement nosync_sendObjectWithObjectMessages:channel:completionWithResult:. Please update ably-cocoa to a version that supports apply-on-ACK.")
188+
preconditionFailure("ably-cocoa does not implement nosync_sendObjectWithObjectMessages:channel:completionWithResult:. Please update ably-cocoa to a version that supports apply-on-ACK.")
187189
}
188190

189191
pluginAPI.nosync_sendObject!(

0 commit comments

Comments
 (0)