Search in sources :

Example 1 with TemplateFileParseFailureException

use of org.lastaflute.core.template.exception.TemplateFileParseFailureException in project lastaflute by lastaflute.

the class SimpleTemplateManager method throwBodyMetaUnknownLineException.

protected void throwBodyMetaUnknownLineException(String templatePath, String evaluated, String line) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Unknown line in the template meta.");
    br.addItem("Advice");
    br.addElement("The template meta should start with option:");
    br.addElement("or fixed style, e.g. '-- !!...!!'");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    maihama     // *Bad: unknown meta definition");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("                // *Bad: empty line not allowed");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    -- !!String memberName!!");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    setupTemplateFileInfo(br, templatePath, evaluated);
    br.addItem("Unknown Line");
    br.addElement(line);
    final String msg = br.buildExceptionMessage();
    throw new TemplateFileParseFailureException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) TemplateFileParseFailureException(org.lastaflute.core.template.exception.TemplateFileParseFailureException)

Example 2 with TemplateFileParseFailureException

use of org.lastaflute.core.template.exception.TemplateFileParseFailureException in project lastaflute by lastaflute.

the class SimpleTemplateManager method throwTemplateMetaNotFoundException.

protected void throwTemplateMetaNotFoundException(String templatePath, String evaluated) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the delimiter for template meta.");
    br.addItem("Advice");
    br.addElement("The delimiter of template meta is '>>>'.");
    br.addElement("It should be defined.");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    ...your template body    // *Bad");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    >>>                      // Good");
    br.addElement("    ...your template body");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    option: ...options");
    br.addElement("    -- !!String memberName!!");
    br.addElement("    >>>                      // Good");
    br.addElement("    ...your template body");
    setupTemplateFileInfo(br, templatePath, evaluated);
    final String msg = br.buildExceptionMessage();
    throw new TemplateFileParseFailureException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) TemplateFileParseFailureException(org.lastaflute.core.template.exception.TemplateFileParseFailureException)

Example 3 with TemplateFileParseFailureException

use of org.lastaflute.core.template.exception.TemplateFileParseFailureException in project lastaflute by lastaflute.

the class SimpleTemplateManager method throwBodyMetaTitleCommentNotFoundException.

protected void throwBodyMetaTitleCommentNotFoundException(String templatePath, String evaluated) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the title in the header comment of template meta.");
    br.addItem("Advice");
    br.addElement("The template meta should contain TITLE in the header comment.");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     ...your template's description     // *Bad");
    br.addElement("    */");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]         // Good");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    setupTemplateFileInfo(br, templatePath, evaluated);
    final String msg = br.buildExceptionMessage();
    throw new TemplateFileParseFailureException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) TemplateFileParseFailureException(org.lastaflute.core.template.exception.TemplateFileParseFailureException)

Example 4 with TemplateFileParseFailureException

use of org.lastaflute.core.template.exception.TemplateFileParseFailureException in project lastaflute by lastaflute.

the class SimpleTemplateManager method throwBodyMetaHeaderCommentEndMarkNoIndependentException.

protected void throwBodyMetaHeaderCommentEndMarkNoIndependentException(String templatePath, String evaluated) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("No independent the header comment end mark in the template meta.");
    br.addItem("Advice");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */ option: ...         // *Bad");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    option: ...            // Good");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    setupTemplateFileInfo(br, templatePath, evaluated);
    final String msg = br.buildExceptionMessage();
    throw new TemplateFileParseFailureException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) TemplateFileParseFailureException(org.lastaflute.core.template.exception.TemplateFileParseFailureException)

Example 5 with TemplateFileParseFailureException

use of org.lastaflute.core.template.exception.TemplateFileParseFailureException in project lastaflute by lastaflute.

the class SimpleTemplateManager method throwBodyMetaNoIndependentDelimiterException.

protected void throwBodyMetaNoIndependentDelimiterException(String templatePath, String evaluated) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("No independent delimter of template meta.");
    br.addItem("Advice");
    br.addElement("The delimter of template meta should be independent in line.");
    br.addElement("For example:");
    br.addElement("  (x)");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */ >>>                    // *Bad");
    br.addElement("    ...your template body");
    br.addElement("  (x)");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    >>> ...your template body // *Bad");
    br.addElement("  (o)");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    >>>                       // Good");
    br.addElement("    ...your template body");
    setupTemplateFileInfo(br, templatePath, evaluated);
    final String msg = br.buildExceptionMessage();
    throw new TemplateFileParseFailureException(msg);
}
Also used : ExceptionMessageBuilder(org.dbflute.helper.message.ExceptionMessageBuilder) TemplateFileParseFailureException(org.lastaflute.core.template.exception.TemplateFileParseFailureException)

Aggregations

ExceptionMessageBuilder (org.dbflute.helper.message.ExceptionMessageBuilder)9 TemplateFileParseFailureException (org.lastaflute.core.template.exception.TemplateFileParseFailureException)9