Skip to content

Commit c9f7860

Browse files
committed
Move try/catch into execute command
So that we're able to catch any errors when this fails.
1 parent eff5f1f commit c9f7860

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

extensions/ql-vscode/src/skeleton-query-wizard.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,14 @@ export class SkeletonQueryWizard {
6969
}
7070

7171
// open a query file
72-
await this.openExampleFile();
72+
73+
try {
74+
await this.openExampleFile();
75+
} catch (e: unknown) {
76+
void this.extLogger.log(
77+
`Could not open example query file: ${getErrorMessage(e)}`,
78+
);
79+
}
7380
}
7481

7582
private async openExampleFile() {
@@ -81,15 +88,9 @@ export class SkeletonQueryWizard {
8188
join(this.qlPackStoragePath, this.folderName, this.fileName),
8289
);
8390

84-
try {
85-
void workspace.openTextDocument(queryFileUri).then((doc) => {
86-
void Window.showTextDocument(doc);
87-
});
88-
} catch (e: unknown) {
89-
void this.extLogger.log(
90-
`Could not open example query file: ${getErrorMessage(e)}`,
91-
);
92-
}
91+
void workspace.openTextDocument(queryFileUri).then((doc) => {
92+
void Window.showTextDocument(doc);
93+
});
9394
}
9495

9596
public getFirstStoragePath() {

0 commit comments

Comments
 (0)