Example usage for com.google.common.css.compiler.ast GssFunctionException GssFunctionException

List of usage examples for com.google.common.css.compiler.ast GssFunctionException GssFunctionException

Introduction

In this page you can find the example usage for com.google.common.css.compiler.ast GssFunctionException GssFunctionException.

Prototype

public GssFunctionException(String message, Throwable e) 

Source Link

Usage

From source file:com.google.gwt.resources.gss.ResourceUrlFunction.java

private void assertMethodIsValidResource(SourceCodeLocation location, List<String> pathElements,
        ErrorManager errorManager) throws GssFunctionException {
    JType methodType;/*from   w w w  .  j av a2 s  .c  o  m*/

    try {
        methodType = ResourceGeneratorUtil.getMethodByPath(context.getClientBundleType(), pathElements, null)
                .getReturnType();
    } catch (NotFoundException e) {
        String message = e.getMessage();
        errorManager.report(new GssError(message, location));
        throw new GssFunctionException(message, e);
    }

    if (!dataResourceType.isAssignableFrom((JClassType) methodType)
            && !imageResourceType.isAssignableFrom((JClassType) methodType)) {
        String message = "Invalid method type for url substitution: " + methodType + ". "
                + "Only DataResource and ImageResource are supported.";
        errorManager.report(new GssError(message, location));
        throw new GssFunctionException(message);
    }
}