Improve error message when using build modes and autobuild fails
This commit is contained in:
parent
7f375aeb76
commit
4aca720110
3 changed files with 39 additions and 3 deletions
19
lib/analyze.js
generated
19
lib/analyze.js
generated
|
|
@ -98,7 +98,24 @@ async function runExtraction(codeql, config, logger, features) {
|
|||
config.buildMode === config_utils_1.BuildMode.Autobuild) {
|
||||
await (0, autobuild_1.setupCppAutobuild)(codeql, logger);
|
||||
}
|
||||
await codeql.extractUsingBuildMode(config, language);
|
||||
try {
|
||||
await codeql.extractUsingBuildMode(config, language);
|
||||
}
|
||||
catch (e) {
|
||||
if (config.buildMode === config_utils_1.BuildMode.Autobuild) {
|
||||
const prefix = "We were unable to automatically build your code. " +
|
||||
"Please change the build mode for this language to manual and specify build steps " +
|
||||
"for your project. For more information, see " +
|
||||
"https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/automatic-build-failed.";
|
||||
const ErrorConstructor = e instanceof util.ConfigurationError
|
||||
? util.ConfigurationError
|
||||
: Error;
|
||||
throw new ErrorConstructor(`${prefix} ${util.wrapError(e).message}`);
|
||||
}
|
||||
else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
await codeql.extractScannedLanguage(config, language);
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -198,7 +198,26 @@ export async function runExtraction(
|
|||
) {
|
||||
await setupCppAutobuild(codeql, logger);
|
||||
}
|
||||
await codeql.extractUsingBuildMode(config, language);
|
||||
try {
|
||||
await codeql.extractUsingBuildMode(config, language);
|
||||
} catch (e) {
|
||||
if (config.buildMode === BuildMode.Autobuild) {
|
||||
const prefix =
|
||||
"We were unable to automatically build your code. " +
|
||||
"Please change the build mode for this language to manual and specify build steps " +
|
||||
"for your project. For more information, see " +
|
||||
"https://docs.github.com/en/code-security/code-scanning/troubleshooting-code-scanning/automatic-build-failed.";
|
||||
const ErrorConstructor =
|
||||
e instanceof util.ConfigurationError
|
||||
? util.ConfigurationError
|
||||
: Error;
|
||||
throw new ErrorConstructor(
|
||||
`${prefix} ${util.wrapError(e).message}`,
|
||||
);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
await codeql.extractScannedLanguage(config, language);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue