Try & Catch When Calling supplyAsync
<p>I am new to CompletableFuture, I will like to call a method MetadataLoginUtil::login which can throw an exception. However, the code below is not compiled although I have 'exceptionally' written. It says that I must wrap the MetadataLoginUtil::login' within try &amp; catch.</p>

<p>Please advise.
Thanks ahead ! </p>

<pre><code>public void run() throws ConnectionException {
    CompletableFuture&lt;Void&gt; mt = CompletableFuture.supplyAsync(MetadataLoginUtil::login)
            .exceptionally(e -&gt; {
                System.out.println(e);
                return null;
            })
            .thenAccept(e -&gt; System.out.println(e));
}
</code></pre>