private RuntimeException unpackExecutionException ( Throwable exc ) { while ( exc instanceof ExecutionException || exc instanceof UncheckedExecutionException ) { exc = exc . getCause ( ) ; } return Throwables . propagate ( exc ) ; }
Due to recursive nature of algorithm we may end up with multiple layers of exceptions . Unpack them .