From 89270588d81b8f26cd8c19225721623a28316b70 Mon Sep 17 00:00:00 2001 From: Matt Creaser Date: Fri, 3 May 2024 15:14:04 -0300 Subject: [PATCH] fix(datastore): List errors that are returned from AppSync (#2801) --- .../datastore/syncengine/SyncProcessor.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/SyncProcessor.java b/aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/SyncProcessor.java index d316c5494d..2acf4acd75 100644 --- a/aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/SyncProcessor.java +++ b/aws-datastore/src/main/java/com/amplifyframework/datastore/syncengine/SyncProcessor.java @@ -53,6 +53,7 @@ import java.util.List; import java.util.Objects; import java.util.concurrent.atomic.AtomicReference; +import java.util.stream.Collectors; import io.reactivex.rxjava3.core.Completable; import io.reactivex.rxjava3.core.Flowable; @@ -320,8 +321,13 @@ private Single { Cancelable cancelable = appSync.sync(request, result -> { if (!result.hasData()) { + List errorStrings = result.getErrors().stream() + .map(GraphQLResponse.Error::toString) + .collect(Collectors.toList()); + String errors = String.join(",\n", errorStrings); + emitter.onError(new DataStoreException.IrRecoverableException( - "Empty response from AppSync.", "Report to AWS team." + "Received errors from AppSync: " + errors, "Report to AWS team." )); } else { if (result.hasErrors()) {