fix: improve error handling in git operations and queries

This commit is contained in:
weishu
2025-12-20 23:09:53 +08:00
parent 8ebd4f6ab9
commit eac7ff239a
3 changed files with 17 additions and 4 deletions
+3 -2
View File
@@ -155,11 +155,12 @@ export function createGitRoutes(getSyncEngine: () => SyncEngine | null): Hono<We
}
const result = await runRpc(() => engine.runRipgrep(sessionResult.sessionId, args, sessionPath))
if (!('success' in result) || !result.success || !result.stdout) {
if (!result.success) {
return c.json({ success: false, error: result.error ?? 'Failed to list files' })
}
const files = result.stdout
const stdout = result.stdout ?? ''
const files = stdout
.split('\n')
.map((line) => line.trim())
.filter((line) => line.length > 0)