瀏覽代碼

Updates error handling on explain AI for patches

main
Keith Daulton 1 年之前
父節點
當前提交
dfe7d1f555
共有 1 個文件被更改,包括 9 次插入2 次删除
  1. +9
    -2
      src/plus/webviews/patchDetails/patchDetailsWebview.ts

+ 9
- 2
src/plus/webviews/patchDetails/patchDetailsWebview.ts 查看文件

@ -463,14 +463,21 @@ export class PatchDetailsWebviewProvider
try {
// TODO@eamodio HACK -- only works for the first patch
const patch = await this.getDraftPatch(this._context.draft);
if (patch == null) return;
if (patch == null) {
throw new Error('Unable to find patch');
}
const commit = await this.getOrCreateCommitForPatch(patch.gkRepositoryId);
if (commit == null) return;
if (commit == null) {
throw new Error('Unable to find commit');
}
const summary = await this.container.ai.explainCommit(commit, {
progress: { location: { viewId: this.host.id } },
});
if (summary == null) {
throw new Error('Error retrieving content');
}
params = { summary: summary };
} catch (ex) {
debugger;

Loading…
取消
儲存