improve error message when config is not found

This commit is contained in:
Robert Brignull 2020-08-28 09:43:25 +01:00
parent 37bac22443
commit 80e2c4fe4a
12 changed files with 39 additions and 19 deletions

8
lib/runner.js generated
View file

@ -141,6 +141,10 @@ program
const logger = logging_1.getRunnerLogger(cmd.debug);
try {
const config = await config_utils_1.getConfig(getTempDir(cmd.tempDir), logger);
if (config === undefined) {
throw new Error("Config file could not be found at expected location. " +
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
}
checkEnvironmentSetup(config);
let language = undefined;
if (cmd.language !== undefined) {
@ -182,6 +186,10 @@ program
const tempDir = getTempDir(cmd.tempDir);
const outputDir = cmd.outputDir || path.join(tempDir, 'codeql-sarif');
const config = await config_utils_1.getConfig(getTempDir(cmd.tempDir), logger);
if (config === undefined) {
throw new Error("Config file could not be found at expected location. " +
"Was the 'init' command run with the same '--temp-dir' argument as this command.");
}
checkEnvironmentSetup(config);
await analyze_1.runAnalyze(repository_1.parseRepositoryNwo(cmd.repository), cmd.commit, cmd.ref, undefined, undefined, undefined, cmd.checkoutPath || process.cwd(), undefined, cmd.githubAuth, parseGithubUrl(cmd.githubUrl), cmd.upload, 'runner', outputDir, config, logger);
}