Skip to content

Commit a8c54b7

Browse files
committed
MRVA: Don't display excessive error/warning pop-ups if user doesn't select a repo list
1 parent 9bb60c9 commit a8c54b7

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

extensions/ql-vscode/src/remote-queries/repository-selection.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { QuickPickItem, window } from 'vscode';
2-
import { showAndLogErrorMessage } from '../helpers';
32
import { logger } from '../logging';
43
import { getRemoteRepositoryLists } from '../config';
54
import { REPO_REGEX } from '../pure/helpers-pure';
5+
import { UserCancellationException } from '../commandRunner';
66

77
export interface RepositorySelection {
88
repositories?: string[];
@@ -44,14 +44,14 @@ export async function getRepositorySelection(): Promise<RepositorySelection> {
4444
} else if (quickpick?.useCustomRepository) {
4545
const customRepo = await getCustomRepo();
4646
if (!customRepo || !REPO_REGEX.test(customRepo)) {
47-
void showAndLogErrorMessage('Invalid repository format. Please enter a valid repository in the format <owner>/<repo> (e.g. github/codeql)');
48-
return {};
47+
throw new UserCancellationException('Invalid repository format. Please enter a valid repository in the format <owner>/<repo> (e.g. github/codeql)');
4948
}
5049
void logger.log(`Entered repository: ${customRepo}`);
5150
return { repositories: [customRepo] };
5251
} else {
53-
void showAndLogErrorMessage('No repositories selected.');
54-
return {};
52+
// We don't need to display a warning pop-up in this case, since the user just escaped out of the operation.
53+
// We set 'true' to make this a silent exception.
54+
throw new UserCancellationException('No repositories selected', true);
5555
}
5656
}
5757

0 commit comments

Comments
 (0)