Package org.gradle.api

Examples of org.gradle.api.GradleScriptException


        }

        public void run() throws GradleScriptException {
            ClassLoader originalLoader = Thread.currentThread().getContextClassLoader();
            listener.beforeScript(script);
            GradleScriptException failure = null;
            Thread.currentThread().setContextClassLoader(script.getContextClassloader());
            script.getStandardOutputCapture().start();
            try {
                script.run();
            } catch (Throwable e) {
                failure = new GradleScriptException(String.format("A problem occurred evaluating %s.", script), e);
            }
            script.getStandardOutputCapture().stop();
            Thread.currentThread().setContextClassLoader(originalLoader);
            listener.afterScript(script, failure);
            if (failure != null) {
View Full Code Here


        assertThat(analyser.transform(failure), sameInstance(failure));
    }

    @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;
View Full Code Here

        assertThat(analyser.transform(failure), sameInstance(cause));
    }

    @Test
    public void prefersScriptExceptionOverContextualException() {
        Throwable cause = new GradleScriptException("broken", new ContextualException());
        Throwable failure = new TaskExecutionException(null, cause);

        Throwable transformedFailure = analyser().transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));
View Full Code Here

        assertThat(gse.getCause(), sameInstance(cause));
    }

    @Test
    public void prefersLocationAwareExceptionOverScriptException() {
        Throwable cause = locationAwareException(new GradleScriptException("broken", new RuntimeException()));
        Throwable failure = new TaskExecutionException(null, cause);

        DefaultExceptionAnalyser analyser = analyser();

        assertThat(analyser.transform(failure), sameInstance(cause));
View Full Code Here

TOP

Related Classes of org.gradle.api.GradleScriptException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.