Skip to content

Commit b3abff3

Browse files
committed
Add some error handling
1 parent 890549f commit b3abff3

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

extensions/ql-vscode/src/extension.ts

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,9 @@ async function activateWithInstalledDistribution(
472472
): Promise<void> {
473473
if (qs !== undefined) {
474474
const dbItem = databaseQuickPick !== undefined
475+
// database selected from multi-database quick pick
475476
? databaseQuickPick
477+
// database currently selected in Databases UI
476478
: await databaseUI.getDatabaseItem(progress, token);
477479
if (dbItem === undefined) {
478480
throw new Error('Can\'t run query without a selected database');
@@ -587,7 +589,12 @@ async function activateWithInstalledDistribution(
587589
);
588590
if (quickpick !== undefined) {
589591
for (const item of quickpick) {
590-
await compileAndRunQuery(false, uri, progress, token, item.databaseItem);
592+
try {
593+
await compileAndRunQuery(false, uri, progress, token, item.databaseItem);
594+
} catch (error) {
595+
// Skip databases that are incompatible with the query, e.g. using a different language.
596+
void helpers.showAndLogErrorMessage(`Skipped database '${item.label}'. ${error}`);
597+
}
591598
}
592599
} else {
593600
void helpers.showAndLogErrorMessage('No databases selected.');

0 commit comments

Comments
 (0)