Package org.gradle.internal.exceptions

Examples of org.gradle.internal.exceptions.LocationAwareException


        Throwable failure = new ContextualMultiCauseException(cause1, cause2);

        Throwable transformedFailure = analyser().transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getCause(), sameInstance(failure));
        assertThat(gse.getReportableCauses(), equalTo(toList(cause1, cause2)));
    }
View Full Code Here


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

        Throwable failure = new TaskExecutionException(null, cause);

        Throwable transformedFailure = analyser().transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getCause(), sameInstance(cause));
    }
View Full Code Here

        notifyAnalyser(analyser, source);

        Throwable transformedFailure = analyser.transform(failure);
        assertThat(transformedFailure, instanceOf(LocationAwareException.class));

        LocationAwareException gse = (LocationAwareException) transformedFailure;
        assertThat(gse.getScriptSource(), sameInstance(source));
        assertThat(gse.getLineNumber(), equalTo(7));
        assertThat(gse.getCause(), sameInstance(failure));
    }
View Full Code Here

        if (failure != null) {
            formatter.format("%n");

            if (failure instanceof LocationAwareException) {
                LocationAwareException scriptException = (LocationAwareException) failure;
                formatter.format("%s%n%n", scriptException.getLocation());
                formatter.format("%s", scriptException.getCause().getMessage());

                for (Throwable cause : scriptException.getReportableCauses()) {
                    formatter.format("%nCause: %s", getMessage(cause));
                }
            } else {
                formatter.format("%s", getMessage(failure));
            }
View Full Code Here

                );
            } catch (Exception e) {
                throw new InvalidPluginException(String.format("An exception occurred applying plugin request %s", request), e);
            }
        } catch (Exception e) {
            throw new LocationAwareException(e, request.getScriptSource(), request.getLineNumber());
        }
    }
View Full Code Here

    private Result resolveToFoundResult(PluginResolver effectivePluginResolver, PluginRequest request) {
        Result result = new Result(request);
        try {
            effectivePluginResolver.resolve(request, result);
        } catch (Exception e) {
            throw new LocationAwareException(
                    new GradleException(String.format("Error resolving plugin %s", request.getDisplayName()), e),
                    request.getScriptSource(), request.getLineNumber());
        }

        if (!result.isFound()) {
            String message = buildNotFoundMessage(request, result);
            Exception exception = new UnknownPluginException(message);
            throw new LocationAwareException(exception, request.getScriptSource(), request.getLineNumber());
        }

        return result;
    }
View Full Code Here

TOP

Related Classes of org.gradle.internal.exceptions.LocationAwareException

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.