Skip to content

Commit 53b3c66

Browse files
committed
Rethrow framework exceptions always
1 parent 0abe44b commit 53b3c66

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

core/runtime/src/main/java/io/quarkiverse/langchain4j/runtime/tool/QuarkusToolExecutor.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private ToolExecutionResult invoke(Object[] params, ToolInvoker invokerInstance)
109109
String result;
110110
if (invocationResult instanceof Uni<?>) { // TODO CS
111111
if (io.vertx.core.Context.isOnEventLoopThread()) {
112-
throw new IllegalStateException(
112+
throw new ToolExecutionException(
113113
"Cannot execute tools returning Uni on event loop thread due to a tool executor limitation");
114114
}
115115
result = handleResult(invokerInstance, ((Uni<?>) invocationResult).await().indefinitely());
@@ -118,6 +118,8 @@ private ToolExecutionResult invoke(Object[] params, ToolInvoker invokerInstance)
118118
}
119119
log.debugv("Tool execution result: {0}", result);
120120
return ToolExecutionResult.builder().result(invocationResult).resultText(result).build();
121+
} catch (ToolExecutionException e) {
122+
throw e;
121123
} catch (Exception e) {
122124
if (context.propagateToolExecutionExceptions) {
123125
throw new ToolExecutionException(e);

0 commit comments

Comments
 (0)