Skip to content

Commit

Permalink
replace logging by TemplateError usage
Browse files Browse the repository at this point in the history
  • Loading branch information
slozenko committed Mar 19, 2024
1 parent 38f81dc commit d35d8af
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions src/main/java/com/hubspot/jinjava/lib/filter/SliceFilter.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
package com.hubspot.jinjava.lib.filter;

import static com.hubspot.jinjava.util.Logging.ENGINE_LOG;

import com.hubspot.jinjava.doc.annotations.JinjavaDoc;
import com.hubspot.jinjava.doc.annotations.JinjavaParam;
import com.hubspot.jinjava.doc.annotations.JinjavaSnippet;
import com.hubspot.jinjava.interpret.InvalidArgumentException;
import com.hubspot.jinjava.interpret.InvalidReason;
import com.hubspot.jinjava.interpret.JinjavaInterpreter;
import com.hubspot.jinjava.interpret.TemplateError;
import com.hubspot.jinjava.interpret.TemplateSyntaxException;
import com.hubspot.jinjava.util.ForLoop;
import com.hubspot.jinjava.util.ObjectIterator;
Expand Down Expand Up @@ -84,8 +83,17 @@ public Object filter(Object var, JinjavaInterpreter interpreter, String... args)
args[0]
);
} else if (slices > MAX_SLICES) {
ENGINE_LOG.warn(
"The limit input value is too large, it's been reduced to " + MAX_SLICES
interpreter.addError(
new TemplateError(
TemplateError.ErrorType.WARNING,
TemplateError.ErrorReason.OVER_LIMIT,
TemplateError.ErrorItem.FILTER,
"The limit input value is too large, it's been reduced to " + MAX_SLICES,
null,
interpreter.getLineNumber(),
interpreter.getPosition(),
null
)
);
slices = MAX_SLICES;
}
Expand Down

0 comments on commit d35d8af

Please sign in to comment.