Skip to content

Commit 304e2f8

Browse files
committed
fix(predictions): trigger onComplete callback with runtime error on service exception
1 parent cfdda77 commit 304e2f8

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,10 @@ public final class FaceLivenessSession: LivenessService {
211211
let savedURLForReconnect,
212212
let serverDate else {
213213
onServiceException(.init(event: exceptionEvent))
214+
// send onComplete with runtime error close code
215+
if let runtimeError = URLSessionWebSocketTask.CloseCode(rawValue: 4005) {
216+
onComplete(.unexpectedClosure(runtimeError))
217+
}
214218
return .stopAndInvalidateSession
215219
}
216220

0 commit comments

Comments
 (0)