Bugfix: show proper error toast when user tries to rename project to conflicting name (#5613)

* Correct error toast behavior so rename error comes through

* Add rename error state to E2E test
This commit is contained in:
Frank Noirot
2025-03-05 18:00:36 -05:00
committed by GitHub
parent b947dad6e9
commit 00ff6371ed
4 changed files with 31 additions and 1 deletions

View File

@ -306,6 +306,9 @@ const ProjectsContextDesktop = ({
('output' in event &&
typeof event.output === 'string' &&
event.output) ||
('error' in event &&
event.error instanceof Error &&
event.error.message) ||
''
),
},
@ -340,6 +343,13 @@ const ProjectsContextDesktop = ({
name = interpolateProjectNameWithIndex(name, nextIndex)
}
// Toast an error if the project name is taken
if (projects.find((p) => p.name === name)) {
return Promise.reject(
new Error(`Project with name "${name}" already exists`)
)
}
await renameProjectDirectory(
window.electron.path.join(defaultDirectory, oldName),
name