Skip to content

Commit c3c1bf0

Browse files
committed
🤖 Fix: Catch runtime creation errors in WORKSPACE_CREATE handler
The WORKSPACE_CREATE IPC handler wasn't catching errors thrown during runtime creation (e.g., validation errors for tilde paths in SSH runtime). This caused tests to fail with unhandled exceptions instead of returning { success: false, error: ... } as expected. Wrap createRuntime() call in try-catch to properly handle validation errors and return them through the IPC boundary. Fixes integration test: 'rejects tilde paths in srcBaseDir (SSH only)' _Generated with `cmux`_
1 parent e0a2179 commit c3c1bf0

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/services/ipcMain.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,15 @@ export class IpcMain {
283283
type: "local",
284284
srcBaseDir: this.config.srcDir,
285285
};
286-
const runtime = createRuntime(finalRuntimeConfig);
286+
287+
// Create runtime - catch validation errors (e.g., tilde paths in SSH)
288+
let runtime;
289+
try {
290+
runtime = createRuntime(finalRuntimeConfig);
291+
} catch (error) {
292+
const errorMsg = error instanceof Error ? error.message : String(error);
293+
return { success: false, error: errorMsg };
294+
}
287295

288296
// Create session BEFORE starting init so events can be forwarded
289297
const session = this.getOrCreateSession(workspaceId);

0 commit comments

Comments
 (0)