Skip to content

Commit f6f0a33

Browse files
fix(error): show a toast error if file tree building fails
1 parent cca74c8 commit f6f0a33

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

apps/app/src/lib/file_tree/builder.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { type FileNode, type GenericPath } from '@/types';
22
import { invoke } from '@tauri-apps/api/core';
3+
import { toast } from 'svelte-sonner';
34

45
export async function build_file_tree_from_fs({
56
path,
@@ -12,6 +13,13 @@ export async function build_file_tree_from_fs({
1213
});
1314
} catch (error) {
1415
console.error('Failed to build file tree:', error);
16+
const description =
17+
error instanceof Error
18+
? error.message
19+
: typeof error === 'string'
20+
? error
21+
: JSON.stringify(error);
22+
toast.error('Failed to build file tree', { description });
1523
throw error;
1624
}
1725
}

0 commit comments

Comments
 (0)