dev add violation notion
Test Workflow / test (push) Successful in 3s

This commit is contained in:
vladp
2026-03-20 16:28:23 +07:00
parent 46c75deacb
commit a42f3e8ed8
@@ -141,17 +141,18 @@ public class SearchImageService {
log.info("SearchAPI response code={}, duration={}ms, engine={}", log.info("SearchAPI response code={}, duration={}ms, engine={}",
response.code(), duration, engine); response.code(), duration, engine);
if (!response.isSuccessful()) {
String errorBody = response.body() != null ? response.body().string() : "null";
throw new IOException("API error " + response.code() + ": " + errorBody);
}
ResponseBody body = response.body(); ResponseBody body = response.body();
if (body == null) { if (body == null) {
throw new IOException("Empty response body"); throw new IOException("Empty response body");
} }
return body.string(); String responseBody = body.string();
if (!response.isSuccessful()) {
throw new IOException("API error " + response.code() + ": " + responseBody);
}
return responseBody;
} }
} }