Search in sources :

Example 6 with GradleScriptException

use of org.gradle.api.GradleScriptException in project gradle by gradle.

the class DefaultExceptionAnalyserTest method usesDeepestScriptExceptionException.

@Test
public void usesDeepestScriptExceptionException() {
    Throwable cause = new GradleScriptException("broken", new RuntimeException());
    Throwable failure = new GradleScriptException("broken", new RuntimeException(cause));
    Throwable transformedFailure = analyser().transform(failure);
    assertThat(transformedFailure, instanceOf(LocationAwareException.class));
    LocationAwareException gse = (LocationAwareException) transformedFailure;
    assertThat(gse.getCause(), sameInstance(cause));
}
Also used : LocationAwareException(org.gradle.internal.exceptions.LocationAwareException) GradleScriptException(org.gradle.api.GradleScriptException) Test(org.junit.Test)

Aggregations

GradleScriptException (org.gradle.api.GradleScriptException)6 Test (org.junit.Test)4 TaskExecutionException (org.gradle.api.tasks.TaskExecutionException)2 LocationAwareException (org.gradle.internal.exceptions.LocationAwareException)2 ArrayList (java.util.ArrayList)1 ProjectConfigurationException (org.gradle.api.ProjectConfigurationException)1 Script (org.gradle.groovy.scripts.Script)1 ServiceCreationException (org.gradle.internal.service.ServiceCreationException)1 IdeaModel (org.gradle.plugins.ide.idea.model.IdeaModel)1 VersionNumber (org.gradle.util.internal.VersionNumber)1 Expectations (org.jmock.Expectations)1 Sequence (org.jmock.Sequence)1