Fix javascript-repl to throw errors on execution failure

- Throw error instead of returning output when result.success is false
- Ensures tool call is marked as failed when code execution fails or is aborted
- Matches browser-javascript error handling pattern
This commit is contained in:
Mario Zechner 2025-10-09 23:30:40 +02:00
parent 4ac774cbbb
commit c0ad46fa01

View file

@ -59,9 +59,8 @@ export async function executeJavaScript(
if (output) output += "\n";
output += `Error: ${result.error?.message || "Unknown error"}\n${result.error?.stack || ""}`;
return {
output: output.trim(),
};
// Throw error so tool call is marked as failed
throw new Error(output.trim());
}
// Add return value if present