From 2dedf5f1b232125a127b3255fc0cbaa3663dee92 Mon Sep 17 00:00:00 2001 From: Abhash Kumar Singh Date: Mon, 1 Jul 2024 14:17:01 -0700 Subject: [PATCH] fix: handle decoding errors --- .../Liveness/Service/FaceLivenessSession.swift | 1 + .../Liveness/Service/ServerDisconnection.swift | 1 + 2 files changed, 2 insertions(+) diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift index ba88e7d7ce..e79ac33e1a 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/FaceLivenessSession.swift @@ -183,6 +183,7 @@ public final class FaceLivenessSession: LivenessService { return fallbackDecoding(message) } } catch { + onComplete(.runtimeError) return false } case .success: diff --git a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/ServerDisconnection.swift b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/ServerDisconnection.swift index f85b01024b..8b1dab8cd5 100644 --- a/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/ServerDisconnection.swift +++ b/AmplifyPlugins/Predictions/AWSPredictionsPlugin/Liveness/Service/ServerDisconnection.swift @@ -11,4 +11,5 @@ import Foundation public enum ServerDisconnection { case disconnectionEvent case unexpectedClosure(URLSessionWebSocketTask.CloseCode) + case runtimeError }