Skip to content

Commit

Permalink
throw template state exception for invalid dict key
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredstehler committed Oct 26, 2015
1 parent 7276a5f commit b7a49e5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/main/java/com/hubspot/jinjava/el/ext/AstDict.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import javax.el.ELContext;

import com.hubspot.jinjava.interpret.TemplateStateException;
import com.hubspot.jinjava.objects.collections.PyMap;

import de.odysseus.el.tree.Bindings;
Expand Down Expand Up @@ -34,7 +35,7 @@ public Object eval(Bindings bindings, ELContext context) {
} else if (entry.getKey() instanceof AstIdentifier) {
key = ((AstIdentifier) entry.getKey()).getName();
} else {
throw new IllegalArgumentException("Dict key must be a string or identifier, was: " + entry.getKey());
throw new TemplateStateException("Dict key must be a string or identifier, was: " + entry.getKey());
}

resolved.put(key, entry.getValue().eval(bindings, context));
Expand Down

0 comments on commit b7a49e5

Please sign in to comment.