diff --git a/spring-ai-retry/src/main/java/org/springframework/ai/retry/RetryUtils.java b/spring-ai-retry/src/main/java/org/springframework/ai/retry/RetryUtils.java index 960382d5c96..0c45fc9b7f5 100644 --- a/spring-ai-retry/src/main/java/org/springframework/ai/retry/RetryUtils.java +++ b/spring-ai-retry/src/main/java/org/springframework/ai/retry/RetryUtils.java @@ -1,5 +1,5 @@ /* - * Copyright 2023-2024 the original author or authors. + * Copyright 2023-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,12 +17,14 @@ package org.springframework.ai.retry; import java.io.IOException; +import java.net.URI; import java.nio.charset.StandardCharsets; import java.time.Duration; import org.slf4j.Logger; import org.slf4j.LoggerFactory; +import org.springframework.http.HttpMethod; import org.springframework.http.client.ClientHttpResponse; import org.springframework.lang.NonNull; import org.springframework.retry.RetryCallback; @@ -37,6 +39,7 @@ * provides a default RetryTemplate and a default ResponseErrorHandler. * * @author Christian Tzolov + * @author Soby Chacko * @since 0.8.1 */ public abstract class RetryUtils { @@ -49,6 +52,11 @@ public boolean hasError(@NonNull ClientHttpResponse response) throws IOException } @Override + public void handleError(URI url, HttpMethod method, @NonNull ClientHttpResponse response) throws IOException { + handleError(response); + } + + @SuppressWarnings("removal") public void handleError(@NonNull ClientHttpResponse response) throws IOException { if (response.getStatusCode().isError()) { String error = StreamUtils.copyToString(response.getBody(), StandardCharsets.UTF_8);