Skip to content

Commit 37a53e4

Browse files
committed
Unwrap OutputTooBigException from ELException when handling
1 parent b60d218 commit 37a53e4

1 file changed

Lines changed: 14 additions & 0 deletions

File tree

src/main/java/com/hubspot/jinjava/el/ExpressionResolver.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import com.hubspot.jinjava.interpret.InvalidArgumentException;
1414
import com.hubspot.jinjava.interpret.InvalidInputException;
1515
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
16+
import com.hubspot.jinjava.interpret.OutputTooBigException;
1617
import com.hubspot.jinjava.interpret.TemplateError;
1718
import com.hubspot.jinjava.interpret.TemplateError.ErrorItem;
1819
import com.hubspot.jinjava.interpret.TemplateError.ErrorReason;
@@ -244,6 +245,19 @@ private void handleELException(String expression, ELException e) {
244245
e
245246
)
246247
);
248+
} else if (e.getCause() != null && e.getCause() instanceof OutputTooBigException) {
249+
interpreter.addError(
250+
new TemplateError(
251+
ErrorType.FATAL,
252+
ErrorReason.OUTPUT_TOO_BIG,
253+
ErrorItem.FUNCTION,
254+
e.getCause().getMessage(),
255+
null,
256+
interpreter.getLineNumber(),
257+
interpreter.getPosition(),
258+
e
259+
)
260+
);
247261
} else {
248262
String originatingException = getRootCauseMessage(e);
249263
final String combinedMessage = String.format(

0 commit comments

Comments
 (0)