Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
package org.springframework.ai.retry.autoconfigure;

import java.io.IOException;
import java.net.URI;
import java.nio.charset.StandardCharsets;

import org.slf4j.Logger;
Expand All @@ -30,6 +31,7 @@
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.lang.NonNull;
import org.springframework.retry.RetryCallback;
Expand All @@ -47,6 +49,7 @@
*
* @author Christian Tzolov
* @author SriVarshan P
* @author Issam El-atif
*/
@AutoConfiguration
@ConditionalOnClass(RetryUtils.class)
Expand Down Expand Up @@ -87,13 +90,19 @@ 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()) {
return;
}

String error = StreamUtils.copyToString(response.getBody(), StandardCharsets.UTF_8);
if (error == null || error.isEmpty()) {
if (error.isEmpty()) {
error = "No response body available";
}

Expand Down