Code example for ExecutionException

Methods: getCause

0
            throw rethrowExecutionException(e);
        } 
    } 
 
    static ElasticSearchException rethrowExecutionException(ExecutionException e) {
        if (e.getCause() instanceof ElasticSearchException) {
            ElasticSearchException esEx = (ElasticSearchException) e.getCause();
            Throwable root = esEx.unwrapCause();
            if (root instanceof ElasticSearchException) {
                return (ElasticSearchException) root;
            } 
            return new UncategorizedExecutionException("Failed execution", root);
        } else { 
            return new UncategorizedExecutionException("Failed execution", e);
        } 
    } 
 
    @Override 
    public void onResponse(L result) {
        set(convert(result));