fix(dynamodb): return a null Message for non-failed item cancellation reason (#1623)

* fix(dynamodb): return a null Message for non-failed item cancellation reason

* fix(ec2): fix flaky launchInstanceUserDataStreamToCloudWatch test

* fix: address PR review feedback for TransactWriteItems and revert unrelated imports
This commit is contained in:
Maciej authored and GitHub committed 2026-07-02 18:23:02 -05:00
1 parent 0ac1a01884
commit 6dfdd892aa
5 files changed
+161 -14

No files matched your search

@@ -1,16 +1,15 @@
package io.github.hectorvent.floci.services.dynamodb;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsErrorResponse;
import io.github.hectorvent.floci.core.common.AwsException;
import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ArrayNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import io.github.hectorvent.floci.core.common.AwsArnUtils;
import io.github.hectorvent.floci.core.common.AwsErrorResponse;
import io.github.hectorvent.floci.core.common.AwsException;
import io.github.hectorvent.floci.core.common.AwsJsonController;
import io.github.hectorvent.floci.services.dynamodb.model.*;
import io.github.hectorvent.floci.services.kinesis.KinesisService;
import io.github.hectorvent.floci.services.dynamodb.TransactionCanceledException;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.ws.rs.core.Response;
@@ -1339,7 +1338,9 @@ public class DynamoDbJsonHandler {
for (TransactionCanceledException.CancellationReason reason : e.getCancellationReasons()) {
ObjectNode r = objectMapper.createObjectNode();
r.put("Code", reason.code().isEmpty() ? "None" : reason.code());
r.put("Message", reason.code().isEmpty() ? "" : "The conditional request failed");
if (!reason.code().isEmpty()) {
r.put("Message", "The conditional request failed");
}
if (reason.item() != null) {
r.set("Item", reason.item());
}