Skip to content

Commit 37de2e7

Browse files
committed
Add better error messages for partial failing variant analysis
Two scenarios handled: 1. no database for existing repo 2. repo does not exits (or no access rights for current user) In either case, an error message is sent to the logs, with a notificaiton in a popup.
1 parent a1bc7eb commit 37de2e7

2 files changed

Lines changed: 33 additions & 6 deletions

File tree

extensions/ql-vscode/src/helpers.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,10 @@ export async function showAndLogWarningMessage(message: string, {
7676
*/
7777
export async function showAndLogInformationMessage(message: string, {
7878
outputLogger = logger,
79-
items = [] as string[]
79+
items = [] as string[],
80+
fullMessage = ''
8081
} = {}): Promise<string | undefined> {
81-
return internalShowAndLog(message, items, outputLogger, Window.showInformationMessage);
82+
return internalShowAndLog(message, items, outputLogger, Window.showInformationMessage, fullMessage);
8283
}
8384

8485
type ShowMessageFn = (message: string, ...items: string[]) => Thenable<string | undefined>;

extensions/ql-vscode/src/remote-queries/run-remote-query.ts

Lines changed: 30 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,12 @@ export interface QlPack {
3333
}
3434

3535
interface QueriesResponse {
36-
workflow_run_id: number
36+
workflow_run_id: number,
37+
errors?: {
38+
invalid_repositories?: string[],
39+
repositories_without_database?: string[],
40+
},
41+
repositories_queried?: string[],
3742
}
3843

3944
/**
@@ -324,14 +329,35 @@ async function runRemoteQueriesApiRequest(
324329
data
325330
}
326331
);
327-
const workflowRunId = response.data.workflow_run_id;
328-
void showAndLogInformationMessage(`Successfully scheduled runs. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${workflowRunId}).`);
329-
return workflowRunId;
332+
const { popupMessage, logMessage } = parseResponse(owner, repo, response.data);
333+
void showAndLogInformationMessage(popupMessage, { fullMessage: logMessage });
334+
return response.data.workflow_run_id;
330335
} catch (error) {
331336
void showAndLogErrorMessage(getErrorMessage(error));
332337
}
333338
}
334339

340+
function parseResponse(owner: string, repo: string, response: QueriesResponse) {
341+
const popupMessage = `Successfully scheduled runs. [Click here to see the progress](https://github.com/${owner}/${repo}/actions/runs/${response.workflowRunId}).`
342+
+ (response.errors ? '\n\nSome repositories could not be scheduled. See extension log for details.' : '');
343+
344+
let logMessage = `Successfully scheduled runs. See https://github.com/${owner}/${repo}/actions/runs/${response.workflow_run_id}.`;
345+
if (response.errors) {
346+
logMessage += '\nSome repositories could not be scheduled.';
347+
if (response.errors.invalid_repositories?.length) {
348+
logMessage += `\nInvalid repositories: ${response.errors.invalid_repositories.join(', ')}`;
349+
}
350+
if (response.errors.repositories_without_database?.length) {
351+
logMessage += `\nRepositories without databases: ${response.errors.repositories_without_database.join(', ')}`;
352+
}
353+
}
354+
355+
return {
356+
popupMessage,
357+
logMessage
358+
};
359+
}
360+
335361
/**
336362
* Updates the default suite of the query pack. This is used to ensure
337363
* only the specified query is run.

0 commit comments

Comments
 (0)