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.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;
}
}