Skip to content

Commit bf6d8e7

Browse files
Jami CogswellJami Cogswell
authored andcommitted
Add names of config settings to error messages
1 parent 4e76a0d commit bf6d8e7

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

extensions/ql-vscode/src/config.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -957,13 +957,13 @@ export class GitHubDatabaseConfigListener
957957

958958
const AUTOFIX_SETTING = new Setting("autofix", ROOT_SETTING);
959959

960-
const AUTOFIX_PATH = new Setting("path", AUTOFIX_SETTING);
960+
export const AUTOFIX_PATH = new Setting("path", AUTOFIX_SETTING);
961961

962962
export function getAutofixPath(): string | undefined {
963963
return AUTOFIX_PATH.getValue<string>() || undefined;
964964
}
965965

966-
const AUTOFIX_MODEL = new Setting("model", AUTOFIX_SETTING);
966+
export const AUTOFIX_MODEL = new Setting("model", AUTOFIX_SETTING);
967967

968968
export function getAutofixModel(): string | undefined {
969969
return AUTOFIX_MODEL.getValue<string>() || undefined;

extensions/ql-vscode/src/variant-analysis/view-autofixes.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ import type { execFileSync } from "child_process";
3535
import { tryOpenExternalFile } from "../common/vscode/external-files";
3636
import type { VariantAnalysisManager } from "./variant-analysis-manager";
3737
import type { VariantAnalysisResultsManager } from "./variant-analysis-results-manager";
38-
import { getAutofixPath, getAutofixModel, downloadTimeout } from "../config";
38+
import {
39+
getAutofixPath,
40+
getAutofixModel,
41+
downloadTimeout,
42+
AUTOFIX_PATH,
43+
AUTOFIX_MODEL,
44+
} from "../config";
3945
import { getErrorMessage } from "../common/helpers-pure";
4046
import { createTimeoutSignal } from "../common/fetch-stream";
4147
import { unzipToDirectoryConcurrently } from "../common/unzip-concurrently";
@@ -140,7 +146,7 @@ async function findLocalAutofix(): Promise<string> {
140146
const localAutofixPath = getAutofixPath();
141147
if (!localAutofixPath) {
142148
throw new Error(
143-
"Path to local autofix installation not found. Internal GitHub access required.",
149+
`Path to local autofix installation not found. Make sure ${AUTOFIX_PATH.qualifiedName} is set correctly. Internal GitHub access required.`,
144150
);
145151
}
146152
if (!(await pathExists(localAutofixPath))) {
@@ -709,7 +715,9 @@ async function runAutofixOnResults(
709715
// Get autofix model from user settings.
710716
const autofixModel = getAutofixModel();
711717
if (!autofixModel) {
712-
throw new Error("Autofix model not found.");
718+
throw new Error(
719+
`Autofix model not found. Make sure ${AUTOFIX_MODEL.qualifiedName} is set correctly.`,
720+
);
713721
}
714722
// Set up args for autofix command.
715723
const autofixArgs = [

0 commit comments

Comments
 (0)