Skip to content

Commit 368cc86

Browse files
committed
Limit call stack function output length
1 parent 02e9d1f commit 368cc86

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

ownlang-core/src/main/java/com/annimon/ownlang/lib/CallStack.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
import java.util.stream.Collectors;
77

88
public final class CallStack {
9-
9+
10+
private static final int MAX_FUNCTION_LENGTH = 62;
1011
private static final Deque<CallInfo> calls = new ConcurrentLinkedDeque<>();
1112

1213
private CallStack() { }
@@ -24,6 +25,9 @@ public static synchronized void enter(String name, Function function, Range rang
2425
if (func.contains("\n")) {
2526
func = func.substring(0, func.indexOf("\n")).trim();
2627
}
28+
if (func.length() > MAX_FUNCTION_LENGTH) {
29+
func = func.substring(0, MAX_FUNCTION_LENGTH) + "...";
30+
}
2731
calls.push(new CallInfo(name, func, range));
2832
}
2933

0 commit comments

Comments
 (0)