use guarded try
This commit is contained in:
parent
923103dec8
commit
49dfd7432c
@ -357,10 +357,13 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
|
||||
}
|
||||
|
||||
private func handleOpen(openData: String) {
|
||||
do {
|
||||
let json = try openData.toNSDictionary()
|
||||
guard let json = try? openData.toNSDictionary() else {
|
||||
didError("Error parsing open packet")
|
||||
return
|
||||
}
|
||||
|
||||
guard let sid = json["sid"] as? String else {
|
||||
client?.engineDidError("Open packet contained no sid")
|
||||
didError("Open packet contained no sid")
|
||||
return
|
||||
}
|
||||
|
||||
@ -391,9 +394,6 @@ public final class SocketEngine : NSObject, NSURLSessionDelegate, SocketEnginePo
|
||||
}
|
||||
|
||||
client?.engineDidOpen("Connect")
|
||||
} catch {
|
||||
didError("Error parsing open packet")
|
||||
}
|
||||
}
|
||||
|
||||
private func handlePong(pongMessage: String) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user