Skip to content
Merged
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
@@ -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.
Expand All @@ -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;
Expand All @@ -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 {
Expand All @@ -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);
Expand Down
Loading