Apply suggestion from @coderabbitai[bot]

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
viper151
2025-11-04 09:39:37 +01:00
committed by GitHub
parent 43cbbb10d9
commit b416e542c7

View File

@@ -101,7 +101,12 @@ router.post('/create-workspace', async (req, res) => {
await cloneGitHubRepository(githubUrl, absolutePath, githubToken);
} catch (error) {
// Clean up created directory on failure
await fs.rm(absolutePath, { recursive: true, force: true });
try {
await fs.rm(absolutePath, { recursive: true, force: true });
} catch (cleanupError) {
console.error('Failed to clean up directory after clone failure:', cleanupError);
// Continue to throw original error
}
throw new Error(`Failed to clone repository: ${error.message}`);
}
}