Add cancellation reason codes to error logging
This commit is contained in:
parent
2c0a75586b
commit
0663fe30df
|
@ -124,7 +124,7 @@ public class AccountsDynamoDb extends AbstractDynamoDbStore implements AccountSt
|
||||||
}
|
}
|
||||||
|
|
||||||
// this shouldn’t happen
|
// this shouldn’t happen
|
||||||
throw new RuntimeException("could not create account");
|
throw new RuntimeException("could not create account: " + extractCancellationReasonCodes(e));
|
||||||
}
|
}
|
||||||
} catch (JsonProcessingException e) {
|
} catch (JsonProcessingException e) {
|
||||||
throw new IllegalArgumentException(e);
|
throw new IllegalArgumentException(e);
|
||||||
|
@ -319,7 +319,9 @@ public class AccountsDynamoDb extends AbstractDynamoDbStore implements AccountSt
|
||||||
@Override
|
@Override
|
||||||
public void onError(Exception exception) {
|
public void onError(Exception exception) {
|
||||||
if (exception instanceof TransactionCanceledException) {
|
if (exception instanceof TransactionCanceledException) {
|
||||||
// account is already migrated
|
// account is likely already migrated
|
||||||
|
logger.warn("Error migrating account: {}",
|
||||||
|
extractCancellationReasonCodes((TransactionCanceledException) exception));
|
||||||
resultFuture.complete(false);
|
resultFuture.complete(false);
|
||||||
} else {
|
} else {
|
||||||
try {
|
try {
|
||||||
|
@ -344,6 +346,12 @@ public class AccountsDynamoDb extends AbstractDynamoDbStore implements AccountSt
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private static String extractCancellationReasonCodes(final TransactionCanceledException exception) {
|
||||||
|
return exception.getCancellationReasons().stream()
|
||||||
|
.map(CancellationReason::getCode)
|
||||||
|
.collect(Collectors.joining(", "));
|
||||||
|
}
|
||||||
|
|
||||||
@VisibleForTesting
|
@VisibleForTesting
|
||||||
static Account fromItem(Item item) {
|
static Account fromItem(Item item) {
|
||||||
try {
|
try {
|
||||||
|
|
Loading…
Reference in New Issue