Template code | Chunk output | |
---|---|---|
{#example_1} {!-- default error handling: see Java tab --} {#} Theme theme = new Theme(); // Load up the main template in [classpath]/themes/beep_boop.chtml // This file does not exist, so it should output an error. Chunk html = theme.makeChunk("beep_boop"); return html.toString(); |
|
[chtml template 'beep_boop' not found]<!-- looked in [themes/examples/beep_boop.chtml] -->
[chtml template 'beep_boop' not found]
|
Template code | Chunk output | |
---|---|---|
{#example_2} {!-- special error trapping: see Java tab --} {#} Theme theme = new Theme(); // Let's hide all errors from appearing in rendered output. // Instead, we'll log errors to STDERR. theme.setErrorHandling(false, System.err); // Load up the main template in [classpath]/themes/beep_boop.chtml // This file does not exist, so it should log an error to stderr. Chunk html = theme.makeChunk("beep_boop"); return html.toString(); |
|
Template code | Chunk output | |
---|---|---|
{#example_3} {!-- fast-fail error handling: see Java tab --} {#} Theme theme = new Theme(); // throw a TemplateNotFoundException if any template can't be located. theme.setAbortOnMissingTemplate(true); // Load up the main template in [classpath]/themes/beep_boop.chtml // This file does not exist, so it will throw an error. Chunk html = theme.makeChunk("beep_boop"); return html.toString(); |
|
Exception thrown: com.x5.template.TemplateNotFoundException
Exception thrown: com.x5.template.TemplateNotFoundException
|