Search in sources :

Example 1 with DefaultMultiCauseException

use of org.gradle.internal.exceptions.DefaultMultiCauseException in project gradle by gradle.

the class DefaultBuildOperationProcessor method doRun.

private <T extends BuildOperation> void doRun(BuildOperationWorker<T> worker, Action<BuildOperationQueue<T>> generator) {
    BuildOperationQueue<T> queue = buildOperationQueueFactory.create(buildOperationWorkerRegistry.getCurrent(), fixedSizePool, worker);
    List<GradleException> failures = Lists.newArrayList();
    try {
        generator.execute(queue);
    } catch (Exception e) {
        failures.add(new BuildOperationQueueFailure("There was a failure while populating the build operation queue: " + e.getMessage(), e));
        queue.cancel();
    }
    try {
        queue.waitForCompletion();
    } catch (MultipleBuildOperationFailures e) {
        failures.add(e);
    }
    if (failures.size() == 1) {
        throw failures.get(0);
    } else if (failures.size() > 1) {
        throw new DefaultMultiCauseException(formatMultipleFailureMessage(failures), failures);
    }
}
Also used : GradleException(org.gradle.api.GradleException) DefaultMultiCauseException(org.gradle.internal.exceptions.DefaultMultiCauseException) GradleException(org.gradle.api.GradleException) DefaultMultiCauseException(org.gradle.internal.exceptions.DefaultMultiCauseException)

Aggregations

GradleException (org.gradle.api.GradleException)1 DefaultMultiCauseException (org.gradle.internal.exceptions.DefaultMultiCauseException)1