private static < T , U > Promise < T > ofFailure ( String message , List < Try < U > > failed ) { StacklessException exception = new StacklessException ( RemoteFsClusterClient . class , message ) ; failed . stream ( ) . map ( Try :: getExceptionOrNull ) . filter ( Objects :: nonNull ) . forEach ( exception :: addSuppressed ) ; return Promise . ofException ( exception ) ; }
shortcut for creating single Exception from list of possibly failed tries