Display return values and fix duplicate error messages in REPL
- javascript-repl now displays return values with => prefix - Objects are JSON.stringify'd with formatting - Removed console.error from wrapper to prevent duplicate error messages - Error is already captured and sent via execution-error message - Fixes missing return value display and duplicate error output
This commit is contained in:
@@ -347,8 +347,7 @@ export class SandboxIframe extends LitElement {
|
|||||||
|
|
||||||
await window.complete(null, returnValue);
|
await window.complete(null, returnValue);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error?.stack || error?.message || String(error));
|
|
||||||
|
|
||||||
// Call completion callbacks before complete() (error path)
|
// Call completion callbacks before complete() (error path)
|
||||||
if (window.__completionCallbacks && window.__completionCallbacks.length > 0) {
|
if (window.__completionCallbacks && window.__completionCallbacks.length > 0) {
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -63,6 +63,12 @@ export async function executeJavaScript(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Add return value if present
|
||||||
|
if (result.returnValue !== undefined) {
|
||||||
|
if (output) output += "\n";
|
||||||
|
output += `=> ${typeof result.returnValue === "object" ? JSON.stringify(result.returnValue, null, 2) : result.returnValue}`;
|
||||||
|
}
|
||||||
|
|
||||||
// Add file notifications
|
// Add file notifications
|
||||||
if (result.files && result.files.length > 0) {
|
if (result.files && result.files.length > 0) {
|
||||||
output += `\n[Files returned: ${result.files.length}]\n`;
|
output += `\n[Files returned: ${result.files.length}]\n`;
|
||||||
|
|||||||
Reference in New Issue
Block a user