Skip to content

Commit 7f82d3b

Browse files
Peter vogelPeter vogel
authored andcommitted
Handle workspace picker results and surface add errors
1 parent 13cea5b commit 7f82d3b

2 files changed

Lines changed: 19 additions & 4 deletions

File tree

src/App.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -196,9 +196,21 @@ function MainApp() {
196196
});
197197

198198
async function handleAddWorkspace() {
199-
const workspace = await addWorkspace();
200-
if (workspace) {
201-
setActiveThreadId(null, workspace.id);
199+
try {
200+
const workspace = await addWorkspace();
201+
if (workspace) {
202+
setActiveThreadId(null, workspace.id);
203+
}
204+
} catch (error) {
205+
const message = error instanceof Error ? error.message : String(error);
206+
addDebugEntry({
207+
id: `${Date.now()}-client-add-workspace-error`,
208+
timestamp: Date.now(),
209+
source: "error",
210+
label: "workspace/add error",
211+
payload: message,
212+
});
213+
alert(`Failed to add workspace.\n\n${message}`);
202214
}
203215
}
204216

src/services/tauri.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,12 @@ import type { GitFileDiff, GitFileStatus, GitLogResponse, ReviewTarget } from ".
55

66
export async function pickWorkspacePath(): Promise<string | null> {
77
const selection = await open({ directory: true, multiple: false });
8-
if (!selection || Array.isArray(selection)) {
8+
if (!selection) {
99
return null;
1010
}
11+
if (Array.isArray(selection)) {
12+
return selection[0] ?? null;
13+
}
1114
return selection;
1215
}
1316

0 commit comments

Comments
 (0)