Skip to content

Commit ab87e6d

Browse files
author
David Hasani
committed
fix(gumby): remove unneeded dep and improve error handling
1 parent b730f71 commit ab87e6d

File tree

3 files changed

+15
-20
lines changed

3 files changed

+15
-20
lines changed

package-lock.json

Lines changed: 0 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4382,7 +4382,6 @@
43824382
"markdown-it": "^13.0.2",
43834383
"mime-types": "^2.1.32",
43844384
"node-fetch": "^2.7.0",
4385-
"parse-diff": "0.11.1",
43864385
"portfinder": "^1.0.32",
43874386
"sanitize-html": "^2.3.3",
43884387
"semver": "^7.5.4",

src/codewhisperer/service/transformationResultsViewProvider.ts

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ export class DiffModel {
140140
*/
141141
public parseDiff(pathToDiff: string, pathToWorkspace: string): ProposedChangeNode[] {
142142
const diffContents = fs.readFileSync(pathToDiff, 'utf8')
143+
if (!diffContents) {
144+
throw new ToolkitError('diff.patch file is empty', { code: 'EmptyDiffPatch' })
145+
}
143146
const changedFiles = parsePatch(diffContents)
144147
// path to the directory containing copy of the changed files in the transformed project
145148
const pathToTmpSrcDir = this.copyProject(pathToWorkspace, changedFiles)
@@ -361,6 +364,18 @@ export class ProposedTransformationExplorer {
361364
transformByQState.setSummaryFilePath(
362365
path.join(pathContainingArchive, ExportResultArchiveStructure.PathToSummary)
363366
)
367+
transformByQState.setResultArchiveFilePath(pathContainingArchive)
368+
369+
// This metric is only emitted when placed before showInformationMessage
370+
telemetry.codeTransform_vcsDiffViewerVisible.emit({
371+
codeTransformSessionId: codeTransformTelemetryState.getSessionId(),
372+
codeTransformJobId: transformByQState.getJobId(),
373+
result: MetadataResult.Pass,
374+
})
375+
376+
// Do not await this so that the summary reveals without user needing to close this notification
377+
void vscode.window.showInformationMessage(CodeWhispererConstants.viewProposedChangesMessage)
378+
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
364379
} catch (e: any) {
365380
deserializeErrorMessage =
366381
(e as Error).message ??
@@ -378,19 +393,6 @@ export class ProposedTransformationExplorer {
378393
reason: deserializeErrorMessage ? 'DeserializationFailed' : undefined,
379394
})
380395
}
381-
382-
transformByQState.setResultArchiveFilePath(pathContainingArchive)
383-
384-
// This metric is only emitted when placed before showInformationMessage
385-
telemetry.codeTransform_vcsDiffViewerVisible.emit({
386-
codeTransformSessionId: codeTransformTelemetryState.getSessionId(),
387-
codeTransformJobId: transformByQState.getJobId(),
388-
result: MetadataResult.Pass,
389-
})
390-
391-
// Do not await this so that the summary reveals without user needing to close this notification
392-
void vscode.window.showInformationMessage(CodeWhispererConstants.viewProposedChangesMessage)
393-
await vscode.commands.executeCommand('aws.amazonq.transformationHub.summary.reveal')
394396
})
395397

396398
vscode.commands.registerCommand('aws.amazonq.transformationHub.reviewChanges.acceptChanges', async () => {

0 commit comments

Comments
 (0)