From effd15c720965090399a6954c14b2285142fff34 Mon Sep 17 00:00:00 2001 From: Peter vogel Date: Mon, 12 Jan 2026 20:31:15 +0100 Subject: [PATCH] Handle workspace picker results and surface add errors --- src/App.tsx | 18 +++++++++++++++--- src/services/tauri.ts | 5 ++++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/src/App.tsx b/src/App.tsx index 2f428ea9e..29281535c 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -196,9 +196,21 @@ function MainApp() { }); async function handleAddWorkspace() { - const workspace = await addWorkspace(); - if (workspace) { - setActiveThreadId(null, workspace.id); + try { + const workspace = await addWorkspace(); + if (workspace) { + setActiveThreadId(null, workspace.id); + } + } catch (error) { + const message = error instanceof Error ? error.message : String(error); + addDebugEntry({ + id: `${Date.now()}-client-add-workspace-error`, + timestamp: Date.now(), + source: "error", + label: "workspace/add error", + payload: message, + }); + alert(`Failed to add workspace.\n\n${message}`); } } diff --git a/src/services/tauri.ts b/src/services/tauri.ts index de9146b28..6789e45a0 100644 --- a/src/services/tauri.ts +++ b/src/services/tauri.ts @@ -5,9 +5,12 @@ import type { GitFileDiff, GitFileStatus, GitLogResponse, ReviewTarget } from ". export async function pickWorkspacePath(): Promise { const selection = await open({ directory: true, multiple: false }); - if (!selection || Array.isArray(selection)) { + if (!selection) { return null; } + if (Array.isArray(selection)) { + return selection[0] ?? null; + } return selection; }