Fixed typo; restrict exception handling to just the loading of a partial
template; pass runtime exceptions through unwrapped.
This commit is contained in:
@@ -386,14 +386,20 @@ public class Mustache
|
|||||||
|
|
||||||
protected static class IncludedTemplateSegment extends Template.Segment {
|
protected static class IncludedTemplateSegment extends Template.Segment {
|
||||||
public IncludedTemplateSegment (final String templateName, final Compiler compiler) {
|
public IncludedTemplateSegment (final String templateName, final Compiler compiler) {
|
||||||
|
Reader r;
|
||||||
try {
|
try {
|
||||||
_template = compiler.compile(compiler.loader.getTemplate(templateName));
|
r = compiler.loader.getTemplate(templateName);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new MustacheException("Unable to load template: " + templateName, e);
|
if (e instanceof RuntimeException) {
|
||||||
|
throw (RuntimeException)e;
|
||||||
|
} else {
|
||||||
|
throw new MustacheException("Unable to load template: " + templateName, e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
_template = compiler.compile(r);
|
||||||
}
|
}
|
||||||
@Override public void execute (Template tmpl, Template.Context ctx, Writer out) {
|
@Override public void execute (Template tmpl, Template.Context ctx, Writer out) {
|
||||||
template.execute(ctx.data, out);
|
_template.execute(ctx.data, out);
|
||||||
}
|
}
|
||||||
protected final Template _template;
|
protected final Template _template;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user