Skip to content

Commit 1756059

Browse files
authored
fix(java): use body as error message APIC-541 (#734)
1 parent ea6c184 commit 1756059

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/retry/RetryOutcome.java

Lines changed: 0 additions & 7 deletions
This file was deleted.

clients/algoliasearch-client-java-2/algoliasearch-core/src/main/java/com/algolia/utils/retry/RetryStrategy.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,11 @@ public Response intercept(Chain chain) throws IOException {
5858
response.close();
5959
continue;
6060
}
61-
// unkown state, fail
62-
throw new AlgoliaApiException(response.message(), response.code());
61+
String message = response.message();
62+
if (response.body() != null) {
63+
message = response.body().string();
64+
}
65+
throw new AlgoliaApiException(message, response.code());
6366
} catch (AlgoliaApiException e) {
6467
throw e;
6568
} catch (SocketTimeoutException e) {

0 commit comments

Comments
 (0)