From 64645558572495898834a5de3a6ccbfc698ab8d7 Mon Sep 17 00:00:00 2001 From: Hui Zhao Date: Fri, 6 Jan 2023 12:54:39 -0800 Subject: [PATCH] fix(datastore): prevent unhandled exception crashing App rebuilding sync expression --- .../amplify/amplify_datastore/AmplifyDataStorePlugin.kt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt index 40da63aa38..18a51a4718 100644 --- a/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt +++ b/packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/AmplifyDataStorePlugin.kt @@ -537,7 +537,14 @@ class AmplifyDataStorePlugin : FlutterPlugin, MethodCallHandler { } ) } - latch.await() + try { + latch.await() + } catch (e: InterruptedException) { + LOG.error( + "Failed to resolve query predicate due to ${e}. Reverting to original query " + + "predicate." + ) + } resolvedQueryPredicate } } catch (e: Exception) {