Add descriptions to requiredFieldMissing and be more lenient

fixes #156, fixes #159
This commit is contained in:
Grishka
2024-05-22 13:06:22 +03:00
parent 08e5faf498
commit 10d63f13bd
6 changed files with 25 additions and 27 deletions

View File

@@ -243,7 +243,7 @@ class OutboundNearbyConnection:NearbyConnection{
}
private func processPairedKeyEncryption(frame:Sharing_Nearby_Frame) throws{
guard frame.hasV1, frame.v1.hasPairedKeyEncryption else { throw NearbyError.requiredFieldMissing }
guard frame.hasV1, frame.v1.hasPairedKeyEncryption else { throw NearbyError.requiredFieldMissing("sharingNearbyFrame.v1.pairedKeyEncryption") }
var pairedResult=Sharing_Nearby_Frame()
pairedResult.version = .v1
pairedResult.v1=Sharing_Nearby_V1Frame()
@@ -255,7 +255,7 @@ class OutboundNearbyConnection:NearbyConnection{
}
private func processPairedKeyResult(frame:Sharing_Nearby_Frame) throws{
guard frame.hasV1, frame.v1.hasPairedKeyResult else { throw NearbyError.requiredFieldMissing }
guard frame.hasV1, frame.v1.hasPairedKeyResult else { throw NearbyError.requiredFieldMissing("sharingNearbyFrame.v1.pairedKeyResult") }
var introduction=Sharing_Nearby_Frame()
introduction.version = .v1
@@ -308,7 +308,7 @@ class OutboundNearbyConnection:NearbyConnection{
}
private func processConsent(frame:Sharing_Nearby_Frame) throws{
guard frame.version == .v1, frame.v1.type == .response else {throw NearbyError.requiredFieldMissing}
guard frame.version == .v1, frame.v1.type == .response else {throw NearbyError.requiredFieldMissing("sharingNearbyFrame.v1.type==response")}
switch frame.v1.connectionResponse.status{
case .accept:
currentState = .sendingFiles