diff --git a/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java b/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java index c91a9a3..1af1cac 100644 --- a/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java +++ b/src/main/java/eu/m724/wtapi/provider/impl/openweathermap/OpenWeatherMapProvider.java @@ -8,6 +8,7 @@ import java.net.http.HttpResponse; import java.net.http.HttpResponse.BodyHandlers; import java.util.ArrayList; import java.util.concurrent.CompletableFuture; +import java.util.concurrent.CompletionException; import java.util.concurrent.ExecutionException; import com.google.gson.JsonObject; @@ -36,11 +37,9 @@ public class OpenWeatherMapProvider extends WeatherProvider { getWeather(new Coordinates(0, 0)); try { - weatherFuture.get(); - } catch (InterruptedException e) { - throw new ProviderException("unexpected interruptedexception"); - } catch (ExecutionException e) { - throw (ProviderException) e.getSuppressed()[0]; // TODO + weatherFuture.join(); + } catch (CompletionException e) { + throw (ProviderException) e; } }