Skip to content

Commit 5c2f604

Browse files
author
Matt Coley
committed
Add method for last error
1 parent 27d4bb7 commit 5c2f604

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/main/java/com/hubspot/jinjava/interpret/JinjavaInterpreter.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -654,6 +654,12 @@ public TemplateError removeError(int index) {
654654
return errors.remove(index);
655655
}
656656

657+
public Optional<TemplateError> getLastError() {
658+
return errors.isEmpty()
659+
? Optional.empty()
660+
: Optional.of(errors.get(errors.size() - 1));
661+
}
662+
657663
public int getScopeDepth() {
658664
return scopeDepth;
659665
}

0 commit comments

Comments
 (0)