Search in sources :

Example 1 with UncategorizedExecutionException

use of org.elasticsearch.common.util.concurrent.UncategorizedExecutionException in project elasticsearch by elastic.

the class AdapterActionFuture method rethrowExecutionException.

static RuntimeException rethrowExecutionException(ExecutionException e) {
    if (e.getCause() instanceof ElasticsearchException) {
        ElasticsearchException esEx = (ElasticsearchException) e.getCause();
        Throwable root = esEx.unwrapCause();
        if (root instanceof ElasticsearchException) {
            return (ElasticsearchException) root;
        } else if (root instanceof RuntimeException) {
            return (RuntimeException) root;
        }
        return new UncategorizedExecutionException("Failed execution", root);
    } else if (e.getCause() instanceof RuntimeException) {
        return (RuntimeException) e.getCause();
    } else {
        return new UncategorizedExecutionException("Failed execution", e);
    }
}
Also used : ElasticsearchException(org.elasticsearch.ElasticsearchException) UncategorizedExecutionException(org.elasticsearch.common.util.concurrent.UncategorizedExecutionException)

Aggregations

ElasticsearchException (org.elasticsearch.ElasticsearchException)1 UncategorizedExecutionException (org.elasticsearch.common.util.concurrent.UncategorizedExecutionException)1