From dfe7d1f555d533b97af8bb2cd4493a85b185f94e Mon Sep 17 00:00:00 2001 From: Keith Daulton Date: Fri, 10 Nov 2023 12:25:49 -0500 Subject: [PATCH] Updates error handling on explain AI for patches --- src/plus/webviews/patchDetails/patchDetailsWebview.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/plus/webviews/patchDetails/patchDetailsWebview.ts b/src/plus/webviews/patchDetails/patchDetailsWebview.ts index 6e5b73f..b6c47c6 100644 --- a/src/plus/webviews/patchDetails/patchDetailsWebview.ts +++ b/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;