From 6f46bcc45991aff75130c941ce96d362aca03e85 Mon Sep 17 00:00:00 2001 From: Andrew Eisenberg Date: Mon, 22 Jun 2020 11:06:10 -0700 Subject: [PATCH] Add better error message when comparing queries Also, fix type error. --- extensions/ql-vscode/src/query-history.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/extensions/ql-vscode/src/query-history.ts b/extensions/ql-vscode/src/query-history.ts index 0d9401db8..b314413a8 100644 --- a/extensions/ql-vscode/src/query-history.ts +++ b/extensions/ql-vscode/src/query-history.ts @@ -554,7 +554,7 @@ the file in the file explorer and dragging it into the workspace.` return otherQuery; } - if (multiSelect.length > 1) { + if (multiSelect?.length > 1) { throw new Error('Please select no more than 2 queries.'); } @@ -572,6 +572,9 @@ the file in the file explorer and dragging it into the workspace.` detail: otherQuery.statusString, query: otherQuery, })); + if (comparableQueryLabels.length < 1) { + throw new Error('No other queries available to compare with.'); + } const choice = await vscode.window.showQuickPick(comparableQueryLabels); return choice?.query; }