Skip to content

Commit a1030bf

Browse files
authored
Merge pull request #9892 from gitbutlerapp/project-cancellation-handling
Handle project creation cancellation gracefully
2 parents f9838e4 + ab5890b commit a1030bf

File tree

3 files changed

+8
-3
lines changed

3 files changed

+8
-3
lines changed

apps/desktop/src/components/ChromeHeader.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@
136136
try {
137137
const project = await projectsService.addProject();
138138
if (!project) {
139-
throw new Error('Failed to add project.');
139+
// User cancelled the project creation
140+
newProjectLoading = false;
141+
return;
140142
}
141143
goto(projectPath(project.id));
142144
} finally {

apps/desktop/src/components/FileMenuAction.svelte

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414
shortcutService.on('add-local-repo', async () => {
1515
const project = await projectsService.addProject();
1616
if (!project) {
17-
throw new Error('Failed to add project.');
17+
// User cancelled the project creation
18+
return;
1819
}
1920
goto(projectPath(project.id));
2021
}),

apps/desktop/src/components/ProjectSwitcher.svelte

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
try {
5050
const project = await projectsService.addProject();
5151
if (!project) {
52-
throw new Error('Failed to add project.');
52+
// User cancelled the project creation
53+
newProjectLoading = false;
54+
return;
5355
}
5456
goto(projectPath(project.id));
5557
} finally {

0 commit comments

Comments
 (0)