Werfen Ausnahme von CompletableFuture

Ich habe den folgenden code:

//How to throw the ServerException?
public void myFunc() throws ServerException{
    //Some code
    CompletableFuture<A> a = CompletableFuture.supplyAsync(() -> {
        try {
            return someObj.someFunc();
        } catch(ServerException ex) {
            //throw ex; gives an error here.
        }
    }));
    //Some code
}

someFunc() wirft einen ServerException. Ich will nicht, dies zu behandeln, sondern hier, die Ausnahmen von someFunc() Anrufer von myFunc().

InformationsquelleAutor ayushgp | 2017-06-07
Schreibe einen Kommentar