Closed
Description
This line will unconditionally wrap error
in a CompletionException
. If the incoming error is already a CompletionException
, this leads to confusing double-wrapping. Consider doing what CompletableFuture
does and conditionally wrapping:
/**
* Returns the encoding of the given (non-null) exception as a
* wrapped CompletionException unless it is one already.
*/
static AltResult encodeThrowable(Throwable x) {
return new AltResult((x instanceof CompletionException) ? x :
new CompletionException(x));
}