Skip to content

Commit 2447a23

Browse files
committed
refactor: make TryConsumer public
1 parent 3f92e4c commit 2447a23

File tree

1 file changed

+1
-20
lines changed

1 file changed

+1
-20
lines changed

core-jdk8/src/main/java/org/bsc/langgraph4j/CompiledGraph.java

+1-20
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import org.bsc.langgraph4j.serializer.MapSerializer;
1212
import org.bsc.langgraph4j.state.AgentState;
1313
import org.bsc.langgraph4j.state.StateSnapshot;
14+
import org.bsc.langgraph4j.utils.TryConsumer;
1415

1516
import java.io.IOException;
1617
import java.util.*;
@@ -24,26 +25,6 @@
2425
import static org.bsc.langgraph4j.StateGraph.END;
2526
import static org.bsc.langgraph4j.StateGraph.START;
2627

27-
28-
@FunctionalInterface
29-
interface TryConsumer<T, Ex extends Throwable> extends Consumer<T> {
30-
31-
void tryAccept( T t ) throws Ex;
32-
33-
default void accept( T t ) {
34-
try {
35-
tryAccept(t);
36-
} catch (Throwable ex) {
37-
throw new RuntimeException(ex);
38-
}
39-
}
40-
41-
static <T,Ex extends Throwable> Consumer<T> Try( TryConsumer<T, Ex> consumer ) {
42-
return consumer;
43-
}
44-
}
45-
46-
4728
/**
4829
* Represents a compiled graph of nodes and edges.
4930
* This class manage the StateGraph execution

0 commit comments

Comments
 (0)