Search in sources :

Example 1 with DfTemplateParsingException

use of org.dbflute.exception.DfTemplateParsingException in project dbflute-core by dbflute.

the class DfFlutistGenerator method throwTemplateParsingException.

protected void throwTemplateParsingException(String inputTemplate, String specifiedInputEncoding, Throwable e) {
    rethrowIfNestedException(inputTemplate, specifiedInputEncoding, e);
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Failed to parse the input template.");
    br.addItem("Input Template");
    br.addElement(inputTemplate + " (" + specifiedInputEncoding + ")");
    final Throwable cause;
    if (e instanceof MethodInvocationException) {
        cause = ((MethodInvocationException) e).getWrappedThrowable();
    } else {
        cause = e;
    }
    final String msg = br.buildExceptionMessage();
    throw new DfTemplateParsingException(msg, cause);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) MethodInvocationException(org.apache.velocity.exception.MethodInvocationException) DfTemplateParsingException(org.dbflute.exception.DfTemplateParsingException)

Aggregations

MethodInvocationException (org.apache.velocity.exception.MethodInvocationException)1 DfTemplateParsingException (org.dbflute.exception.DfTemplateParsingException)1 ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)1