Skip to content

Commit 40029db

Browse files
committed
feat: add client error logging to terminal output
- Add IPC handler for client-side errors in app_handlers.ts - Update terminal_handlers.ts to route client-error type to frontend terminal - Add logClientError method to IpcClient for frontend error reporting - Client fetch errors now appear in terminal output instead of just browser console
1 parent 7a340d1 commit 40029db

File tree

3 files changed

+28
-0
lines changed

3 files changed

+28
-0
lines changed

src/ipc/handlers/app_handlers.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1168,6 +1168,21 @@ export function registerAppHandlers() {
11681168
app.quit();
11691169
});
11701170

1171+
// Handle client-side errors from frontend
1172+
handle("log-client-error", async (event, { appId, error, context }) => {
1173+
const errorMessage = `Frontend Error: ${error.message || error}\n${context || ''}`.trim();
1174+
1175+
// Log to system console
1176+
logger.error(`Client error from app ${appId}:`, error);
1177+
1178+
// Route to frontend terminal output
1179+
safeSend(event.sender, "app:output", {
1180+
type: "client-error",
1181+
message: errorMessage,
1182+
appId,
1183+
});
1184+
});
1185+
11711186
handle(
11721187
"create-app",
11731188
async (

src/ipc/handlers/terminal_handlers.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ export function routeTerminalOutput(event: Electron.IpcMainInvokeEvent, appId: n
9595
terminalOutputType = "error";
9696
} else if (type === "stdout") {
9797
terminalOutputType = "output";
98+
} else if (type === "client-error") {
99+
terminalOutputType = "error";
98100
}
99101

100102
// Add to all target terminals

src/ipc/ipc_client.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1260,4 +1260,15 @@ export class IpcClient {
12601260
public async roocodeAuthCallback(code: string, state: string): Promise<void> {
12611261
return this.ipcRenderer.invoke("roocode:auth-callback", code, state);
12621262
}
1263+
1264+
// Send client-side errors to terminal output
1265+
public logClientError(appId: number, error: any, context?: string): void {
1266+
this.ipcRenderer.invoke("log-client-error", {
1267+
appId,
1268+
error,
1269+
context,
1270+
}).catch((err) => {
1271+
console.error("Failed to log client error:", err);
1272+
});
1273+
}
12631274
}

0 commit comments

Comments
 (0)