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:
@@ -59,9 +59,8 @@ export async function executeJavaScript(
|
|||||||
if (output) output += "\n";
|
if (output) output += "\n";
|
||||||
output += `Error: ${result.error?.message || "Unknown error"}\n${result.error?.stack || ""}`;
|
output += `Error: ${result.error?.message || "Unknown error"}\n${result.error?.stack || ""}`;
|
||||||
|
|
||||||
return {
|
// Throw error so tool call is marked as failed
|
||||||
output: output.trim(),
|
throw new Error(output.trim());
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add return value if present
|
// Add return value if present
|
||||||
|
|||||||
Reference in New Issue
Block a user