Search in sources :

Example 6 with TemplateFileParseFailureException

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

the class SimpleTemplateManager method throwTemplateMetaNotStartWithHeaderCommentException.

protected void throwTemplateMetaNotStartWithHeaderCommentException(String templatePath, String evaluated, String meta) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not start with the header comment in the template meta.");
    br.addItem("Advice");
    br.addElement("The template meta should start with '/*' and should contain '*/'.");
    br.addElement("It means header comment of template file is required.");
    br.addElement("For example:");
    br.addElement("  (x)");
    br.addElement("    subject: ...              // *Bad");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("");
    br.addElement("  (o)");
    br.addElement("    /*                        // Good");
    br.addElement("     [...your template's title]");
    br.addElement("     ...your template's description");
    br.addElement("    */");
    br.addElement("    subject: ...");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("");
    br.addElement("And example:");
    br.addElement("  /*");
    br.addElement("   [New Member's Registration]");
    br.addElement("   The memebr will be formalized after click.");
    br.addElement("   And the ...");
    br.addElement("  */");
    br.addElement("  >>>");
    br.addElement("  Hello, sea");
    br.addElement("  ...");
    setupTemplateFileInfo(br, templatePath, evaluated);
    br.addItem("Body Meta");
    br.addElement(meta);
    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 7 with TemplateFileParseFailureException

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

the class SimpleTemplateManager method throwBodyMetaHeaderCommentEndMarkNotFoundException.

protected void throwBodyMetaHeaderCommentEndMarkNotFoundException(String templatePath, String evaluated, String meta) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the header comment end mark in the template meta.");
    br.addItem("Advice");
    br.addElement("The template meta should start with '/*' and should contain '*/'.");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     ...");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     ...");
    br.addElement("    >>>");
    br.addElement("    */");
    br.addElement("    ...your template body");
    br.addElement("  (o):");
    br.addElement("    /*");
    br.addElement("     ...");
    br.addElement("    */              // Good");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    setupTemplateFileInfo(br, templatePath, evaluated);
    br.addItem("Body Meta");
    br.addElement(meta);
    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 8 with TemplateFileParseFailureException

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

the class SimpleTemplateManager method throwBodyMetaUnknownOptionException.

protected void throwBodyMetaUnknownOptionException(String bodyFile, String fileText, String option) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Unknown option for MailFlute body meta.");
    br.addItem("Advice");
    br.addElement("You can specify the following option:");
    br.addElement(optionSet);
    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("    option: maihama      // *Bad: unknown option");
    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: genAsIs      // Good");
    br.addElement("    >>>");
    br.addElement("    ...your template body");
    br.addItem("Body File");
    br.addElement(bodyFile);
    br.addItem("File Text");
    br.addElement(fileText);
    br.addItem("Unknown Option");
    br.addElement(option);
    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 9 with TemplateFileParseFailureException

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

the class SimpleTemplateManager method throwBodyMetaDescriptionCommentNotFoundException.

protected void throwBodyMetaDescriptionCommentNotFoundException(String templatePath, String evaluated) {
    final ExceptionMessageBuilder br = new ExceptionMessageBuilder();
    br.addNotice("Not found the description in the header comment of template meta.");
    br.addItem("Advice");
    br.addElement("The template meta should contain DESCRIPTION");
    br.addElement("in the header comment like this:");
    br.addElement("For example:");
    br.addElement("  (x):");
    br.addElement("    /*");
    br.addElement("     [...your template's title]");
    br.addElement("    */                                  // *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     // Good");
    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)

Aggregations

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