diff --git a/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java b/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java index 22204171..14deb0d4 100644 --- a/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java +++ b/src/main/java/org/ice4j/ice/harvest/AwsCandidateHarvester.java @@ -265,6 +265,10 @@ private static String fetch(String url, Map headers, String meth builder.setHeader(header.getKey(), header.getValue()); } HttpResponse response = httpClient.send(builder.build(), HttpResponse.BodyHandlers.ofString()); + if (response.statusCode() != 200) + { + throw new Exception("Failed to fetch " + url + ". Response code: " + response.statusCode()); + } return response.body(); } }