mirror of
https://github.com/leonboe1/QuickDrop.git
synced 2026-11-11 02:51:11 +00:00
Better error handling
This commit is contained in:
1 parent
7fbe254118
commit
e828edd6ae
1 file changed
+8
-1
@@ -189,7 +189,14 @@ class NearbyConnection {
|
||||
}
|
||||
guard let content = content else {
|
||||
log("[NearbyConnection \(self.id)] Received nil content during receiveFrameAsync(). IsComplete: \(isComplete)")
|
||||
assertionFailure()
|
||||
self.lastError = NearbyError.protocolError("Received empty frame header")
|
||||
self.protocolError()
|
||||
return
|
||||
}
|
||||
guard content.count == 4 else {
|
||||
log("[NearbyConnection \(self.id)] Received invalid frame header size \(content.count), expected 4")
|
||||
self.lastError = NearbyError.protocolError("Unexpected frame header length")
|
||||
self.protocolError()
|
||||
return
|
||||
}
|
||||
let frameLength = UInt32(content[0]) << 24 | UInt32(content[1]) << 16 | UInt32(content[2]) << 8 | UInt32(content[3])
|
||||
|
||||
Reference in new issue
Block a user