fix exception throwing in init

This commit is contained in:
Minecon724 2024-06-09 15:53:06 +02:00
parent 607596a86e
commit a04043c101
Signed by: Minecon724
GPG key ID: 3CCC4D267742C8E8

View file

@ -8,6 +8,7 @@ import java.net.http.HttpResponse;
import java.net.http.HttpResponse.BodyHandlers; import java.net.http.HttpResponse.BodyHandlers;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException; import java.util.concurrent.ExecutionException;
import com.google.gson.JsonObject; import com.google.gson.JsonObject;
@ -36,11 +37,9 @@ public class OpenWeatherMapProvider extends WeatherProvider {
getWeather(new Coordinates(0, 0)); getWeather(new Coordinates(0, 0));
try { try {
weatherFuture.get(); weatherFuture.join();
} catch (InterruptedException e) { } catch (CompletionException e) {
throw new ProviderException("unexpected interruptedexception"); throw (ProviderException) e;
} catch (ExecutionException e) {
throw (ProviderException) e.getSuppressed()[0]; // TODO
} }
} }