Skip to content

Commit ea8137f

Browse files
authored
Merge pull request #2382 from github/angelapwen/make-autobuild-config-error
Classify autobuild errors as configuration errors
2 parents 44534b7 + b516521 commit ea8137f

File tree

6 files changed

+18
-6
lines changed

6 files changed

+18
-6
lines changed

lib/cli-errors.js

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/cli-errors.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.test.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli-errors.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ function ensureEndsInPeriod(text: string): string {
122122

123123
/** Error messages from the CLI that we consider configuration errors and handle specially. */
124124
export enum CliConfigErrorCategory {
125+
AutobuildError = "AutobuildError",
125126
ExternalRepositoryCloneFailed = "ExternalRepositoryCloneFailed",
126127
GradleBuildFailed = "GradleBuildFailed",
127128
IncompatibleWithActionVersion = "IncompatibleWithActionVersion",
@@ -156,6 +157,11 @@ export const cliErrorsConfig: Record<
156157
CliConfigErrorCategory,
157158
CliErrorConfiguration
158159
> = {
160+
[CliConfigErrorCategory.AutobuildError]: {
161+
cliErrorMessageCandidates: [
162+
new RegExp("We were unable to automatically build your code"),
163+
],
164+
},
159165
[CliConfigErrorCategory.ExternalRepositoryCloneFailed]: {
160166
cliErrorMessageCandidates: [
161167
new RegExp("Failed to clone external Git repository"),

src/codeql.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -906,7 +906,7 @@ test("runTool summarizes autobuilder errors", async (t) => {
906906
await t.throwsAsync(
907907
async () => await codeqlObject.runAutobuild(stubConfig, Language.java),
908908
{
909-
instanceOf: CommandInvocationError,
909+
instanceOf: util.ConfigurationError,
910910
message:
911911
"We were unable to automatically build your code. Please provide manual build steps. " +
912912
"For more information, see " +
@@ -934,7 +934,7 @@ test("runTool truncates long autobuilder errors", async (t) => {
934934
await t.throwsAsync(
935935
async () => await codeqlObject.runAutobuild(stubConfig, Language.java),
936936
{
937-
instanceOf: CommandInvocationError,
937+
instanceOf: util.ConfigurationError,
938938
message:
939939
"We were unable to automatically build your code. Please provide manual build steps. " +
940940
"For more information, see " +

0 commit comments

Comments
 (0)