Skip to content

Commit 7663498

Browse files
ElderMattCopilot
andcommitted
fix: make distinction between errors
Co-authored-by: Copilot <copilot@github.com>
1 parent d6f12db commit 7663498

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

src/api/v2/git.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,15 @@ export const migrateGit = async (req: OpenApiRequestExt, res: Response): Promise
2929
try {
3030
remoteHasContent = await req.otomi.git.testRemoteConnection(repoUrl, password, branch, username)
3131
} catch (e: any) {
32-
const error = { message: `Cannot connect to new git remote: ${e.message}`, statusCode: 404 }
33-
res.json(error)
34-
return
32+
if (e.message.includes('not found')) {
33+
const error = { message: `Cannot connect to new git remote: ${e.message}`, statusCode: 404 }
34+
res.json(error)
35+
return
36+
} else {
37+
const error = { message: `Error connecting to new git remote: ${e.message}`, statusCode: 400 }
38+
res.json(error)
39+
return
40+
}
3541
}
3642

3743
// Write config + commit locally → push to new remote (if empty) → push to current remote

0 commit comments

Comments
 (0)