mirror of
https://github.com/QwenLM/qwen-code.git
synced 2026-05-01 05:00:46 +00:00
fix(checkpointing): improve error handling and messaging for Git issues (#6801)
This commit is contained in:
parent
31cd35b8c4
commit
e1d5dc545d
2 changed files with 38 additions and 12 deletions
|
|
@ -31,7 +31,13 @@ export class GitService {
|
|||
'Checkpointing is enabled, but Git is not installed. Please install Git or disable checkpointing to continue.',
|
||||
);
|
||||
}
|
||||
this.setupShadowGitRepository();
|
||||
try {
|
||||
await this.setupShadowGitRepository();
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Failed to initialize checkpointing: ${error instanceof Error ? error.message : 'Unknown error'}. Please check that Git is working properly or disable checkpointing.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
verifyGitAvailability(): Promise<boolean> {
|
||||
|
|
@ -105,10 +111,16 @@ export class GitService {
|
|||
}
|
||||
|
||||
async createFileSnapshot(message: string): Promise<string> {
|
||||
const repo = this.shadowGitRepository;
|
||||
await repo.add('.');
|
||||
const commitResult = await repo.commit(message);
|
||||
return commitResult.commit;
|
||||
try {
|
||||
const repo = this.shadowGitRepository;
|
||||
await repo.add('.');
|
||||
const commitResult = await repo.commit(message);
|
||||
return commitResult.commit;
|
||||
} catch (error) {
|
||||
throw new Error(
|
||||
`Failed to create checkpoint snapshot: ${error instanceof Error ? error.message : 'Unknown error'}. Checkpointing may not be working properly.`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
async restoreProjectFromSnapshot(commitHash: string): Promise<void> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue