Added MustacheContextException
Solving need to distinguish context errors from environment errors. The exception has fields for the offending key and line number. This is a first step towards internationalization of messages.
This commit is contained in:
@@ -609,8 +609,8 @@ public class Mustache
|
||||
@Override public void execute (Template tmpl, Template.Context ctx, Writer out) {
|
||||
Object value = tmpl.getValueOrDefault(ctx, _name, _line);
|
||||
if (value == null) {
|
||||
throw new MustacheException(
|
||||
"No key, method or field with name '" + _name + "' on line " + _line);
|
||||
throw new MustacheContextException(
|
||||
"No key, method or field with name '" + _name + "' on line " + _line, _name, _line);
|
||||
}
|
||||
String text = String.valueOf(value);
|
||||
write(out, _escapeHTML ? escapeHTML(text) : text);
|
||||
|
||||
Reference in New Issue
Block a user