Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix compile error "Enum cases with associated values cannot be marked potentially unavailable with '@available'" #391

Merged
merged 3 commits into from
Sep 25, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions Source/CocoaMQTTTypes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,15 @@ extension UInt8 {
}

public enum CocoaMQTTError: Error {

@available(OSX 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
enum FoundationConnection : Error {
KarinBerg marked this conversation as resolved.
Show resolved Hide resolved
case closed(URLSessionWebSocketTask.CloseCode)
}

case invalidURL
case readTimeout
case writeTimeout

@available(OSX 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, *)
case closed(URLSessionWebSocketTask.CloseCode)
}

extension Array where Element == UInt8 {
Expand Down
2 changes: 1 addition & 1 deletion Source/CocoaMQTTWebSocket.swift
Original file line number Diff line number Diff line change
Expand Up @@ -368,7 +368,7 @@ extension CocoaMQTTWebSocket.FoundationConnection: URLSessionWebSocketDelegate {

public func urlSession(_ session: URLSession, webSocketTask: URLSessionWebSocketTask, didCloseWith closeCode: URLSessionWebSocketTask.CloseCode, reason: Data?) {
queue.async {
self.delegate?.connectionClosed(self, withError: CocoaMQTTError.closed(closeCode))
self.delegate?.connectionClosed(self, withError: CocoaMQTTError.FoundationConnection.closed(closeCode))
}
}
}
Expand Down