Proper way to adapt an exception with CompletableFuture
问题 I am working on chaining CompletableFuture to adapt an exception. While I have something that is working, I don't understand why it works. @Test public void futureExceptionAdapt() throws ExecutionException, InterruptedException { class SillyException extends Exception { } class AdaptedException extends Exception { AdaptedException(SillyException silly) { } } CompletableFuture<Integer> future = CompletableFuture.supplyAsync(() -> { sleepForThreeSeconds(); if (true) throw new