fix exception throwing in init
This commit is contained in:
parent
607596a86e
commit
a04043c101
1 changed files with 4 additions and 5 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue