Include current exception in log message for failed retry attempt

Prior to this commit, we included the initial exception in the log
message for the initial invocation of a retryable operation; however,
we did not include the current exception in the log message for
subsequent attempts.

For consistency, we now include the current exception in log messages
for subsequent retry attempts as well.

Closes gh-35433
This commit is contained in:
Sam Brannen
2025-09-06 16:16:38 +02:00
parent d218b0899a
commit 7b2730c271
@@ -178,7 +178,7 @@ public class RetryTemplate implements RetryOperations {
return result;
}
catch (Throwable currentException) {
logger.debug(() -> "Retry attempt for operation '%s' failed due to '%s'"
logger.debug(currentException, () -> "Retry attempt for operation '%s' failed due to '%s'"
.formatted(retryableName, currentException));
this.retryListener.onRetryFailure(this.retryPolicy, retryable, currentException);
exceptions.add(currentException);