Skip to content

Commit eeb089a

Browse files
authored
Background - error handling for commit message generation (#4356)
1 parent f18d18a commit eeb089a

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

src/extension/chatSessions/vscode-node/chatSessionWorktreeServiceImpl.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -484,8 +484,15 @@ export class ChatSessionWorktreeService extends Disposable implements IChatSessi
484484
return;
485485
}
486486

487-
this.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] Generating commit message for working directory ${worktreePath}. Repository state: ${JSON.stringify(repository.state)}`);
488-
let message = await this.gitCommitMessageService.generateCommitMessage(repository, CancellationToken.None);
487+
let message: string | undefined;
488+
try {
489+
this.logService.trace(`[ChatSessionWorktreeService][handleRequestCompleted] Generating commit message for working directory ${worktreePath}. Repository state: ${JSON.stringify(repository.state)}`);
490+
message = await this.gitCommitMessageService.generateCommitMessage(repository, CancellationToken.None);
491+
} catch (error) {
492+
const errorMessage = error instanceof Error ? error.message : String(error);
493+
this.logService.error(`[ChatSessionWorktreeService][handleRequestCompleted] Error generating commit message for working directory ${worktreePath}. Repository state: ${JSON.stringify(repository.state)}. Error: ${errorMessage}`);
494+
}
495+
489496
if (!message) {
490497
// Fallback commit message
491498
this.logService.warn(`[ChatSessionWorktreeService][handleRequestCompleted] Unable to generate commit message for working directory ${worktreePath}. Repository state: ${JSON.stringify(repository.state)}`);

0 commit comments

Comments
 (0)