Merge pull request #2277 from github/henrymercer/more-user-errors

Add more user errors
This commit is contained in:
Henry Mercer 2024-05-08 18:49:21 +01:00 committed by GitHub
commit 715d348a99
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 28 additions and 2 deletions

10
lib/cli-errors.js generated
View file

@ -117,6 +117,7 @@ function ensureEndsInPeriod(text) {
var CliConfigErrorCategory; var CliConfigErrorCategory;
(function (CliConfigErrorCategory) { (function (CliConfigErrorCategory) {
CliConfigErrorCategory["ExternalRepositoryCloneFailed"] = "ExternalRepositoryCloneFailed"; CliConfigErrorCategory["ExternalRepositoryCloneFailed"] = "ExternalRepositoryCloneFailed";
CliConfigErrorCategory["GracefulOutOfMemory"] = "GracefulOutOfMemory";
CliConfigErrorCategory["GradleBuildFailed"] = "GradleBuildFailed"; CliConfigErrorCategory["GradleBuildFailed"] = "GradleBuildFailed";
CliConfigErrorCategory["IncompatibleWithActionVersion"] = "IncompatibleWithActionVersion"; CliConfigErrorCategory["IncompatibleWithActionVersion"] = "IncompatibleWithActionVersion";
CliConfigErrorCategory["InitCalledTwice"] = "InitCalledTwice"; CliConfigErrorCategory["InitCalledTwice"] = "InitCalledTwice";
@ -127,6 +128,7 @@ var CliConfigErrorCategory;
CliConfigErrorCategory["NoSourceCodeSeen"] = "NoSourceCodeSeen"; CliConfigErrorCategory["NoSourceCodeSeen"] = "NoSourceCodeSeen";
CliConfigErrorCategory["NoSupportedBuildCommandSucceeded"] = "NoSupportedBuildCommandSucceeded"; CliConfigErrorCategory["NoSupportedBuildCommandSucceeded"] = "NoSupportedBuildCommandSucceeded";
CliConfigErrorCategory["NoSupportedBuildSystemDetected"] = "NoSupportedBuildSystemDetected"; CliConfigErrorCategory["NoSupportedBuildSystemDetected"] = "NoSupportedBuildSystemDetected";
CliConfigErrorCategory["PackCannotBeFound"] = "PackCannotBeFound";
CliConfigErrorCategory["SwiftBuildFailed"] = "SwiftBuildFailed"; CliConfigErrorCategory["SwiftBuildFailed"] = "SwiftBuildFailed";
CliConfigErrorCategory["UnsupportedBuildMode"] = "UnsupportedBuildMode"; CliConfigErrorCategory["UnsupportedBuildMode"] = "UnsupportedBuildMode";
})(CliConfigErrorCategory || (exports.CliConfigErrorCategory = CliConfigErrorCategory = {})); })(CliConfigErrorCategory || (exports.CliConfigErrorCategory = CliConfigErrorCategory = {}));
@ -140,6 +142,9 @@ exports.cliErrorsConfig = {
new RegExp("Failed to clone external Git repository"), new RegExp("Failed to clone external Git repository"),
], ],
}, },
[CliConfigErrorCategory.GracefulOutOfMemory]: {
cliErrorMessageCandidates: [new RegExp("CodeQL is out of memory.")],
},
[CliConfigErrorCategory.GradleBuildFailed]: { [CliConfigErrorCategory.GradleBuildFailed]: {
cliErrorMessageCandidates: [ cliErrorMessageCandidates: [
new RegExp("[autobuild] FAILURE: Build failed with an exception."), new RegExp("[autobuild] FAILURE: Build failed with an exception."),
@ -195,6 +200,11 @@ exports.cliErrorsConfig = {
new RegExp("No supported build system detected"), new RegExp("No supported build system detected"),
], ],
}, },
[CliConfigErrorCategory.PackCannotBeFound]: {
cliErrorMessageCandidates: [
new RegExp("Query pack .* cannot be found\\. Check the spelling of the pack\\."),
],
},
[CliConfigErrorCategory.SwiftBuildFailed]: { [CliConfigErrorCategory.SwiftBuildFailed]: {
cliErrorMessageCandidates: [ cliErrorMessageCandidates: [
new RegExp("\\[autobuilder/build\\] \\[build-command-failed\\] `autobuild` failed to run the build command"), new RegExp("\\[autobuilder/build\\] \\[build-command-failed\\] `autobuild` failed to run the build command"),

File diff suppressed because one or more lines are too long

2
lib/upload-lib.js generated
View file

@ -520,6 +520,8 @@ function shouldConsiderConfigurationError(processingErrors) {
*/ */
function shouldConsiderInvalidRequest(processingErrors) { function shouldConsiderInvalidRequest(processingErrors) {
return processingErrors.every((error) => error.startsWith("rejecting SARIF") || return processingErrors.every((error) => error.startsWith("rejecting SARIF") ||
error.startsWith("an invalid URI was provided as a SARIF location") ||
error.startsWith("locationFromSarifResult: expected artifact location") ||
error.startsWith("could not convert rules: invalid security severity value, is not a number") || error.startsWith("could not convert rules: invalid security severity value, is not a number") ||
/^SARIF URI scheme [^\s]* did not match the checkout URI scheme [^\s]*/.test(error)); /^SARIF URI scheme [^\s]* did not match the checkout URI scheme [^\s]*/.test(error));
} }

File diff suppressed because one or more lines are too long

View file

@ -122,6 +122,7 @@ function ensureEndsInPeriod(text: string): string {
/** Error messages from the CLI that we consider configuration errors and handle specially. */ /** Error messages from the CLI that we consider configuration errors and handle specially. */
export enum CliConfigErrorCategory { export enum CliConfigErrorCategory {
ExternalRepositoryCloneFailed = "ExternalRepositoryCloneFailed", ExternalRepositoryCloneFailed = "ExternalRepositoryCloneFailed",
GracefulOutOfMemory = "GracefulOutOfMemory",
GradleBuildFailed = "GradleBuildFailed", GradleBuildFailed = "GradleBuildFailed",
IncompatibleWithActionVersion = "IncompatibleWithActionVersion", IncompatibleWithActionVersion = "IncompatibleWithActionVersion",
InitCalledTwice = "InitCalledTwice", InitCalledTwice = "InitCalledTwice",
@ -132,6 +133,7 @@ export enum CliConfigErrorCategory {
NoSourceCodeSeen = "NoSourceCodeSeen", NoSourceCodeSeen = "NoSourceCodeSeen",
NoSupportedBuildCommandSucceeded = "NoSupportedBuildCommandSucceeded", NoSupportedBuildCommandSucceeded = "NoSupportedBuildCommandSucceeded",
NoSupportedBuildSystemDetected = "NoSupportedBuildSystemDetected", NoSupportedBuildSystemDetected = "NoSupportedBuildSystemDetected",
PackCannotBeFound = "PackCannotBeFound",
SwiftBuildFailed = "SwiftBuildFailed", SwiftBuildFailed = "SwiftBuildFailed",
UnsupportedBuildMode = "UnsupportedBuildMode", UnsupportedBuildMode = "UnsupportedBuildMode",
} }
@ -156,6 +158,9 @@ export const cliErrorsConfig: Record<
new RegExp("Failed to clone external Git repository"), new RegExp("Failed to clone external Git repository"),
], ],
}, },
[CliConfigErrorCategory.GracefulOutOfMemory]: {
cliErrorMessageCandidates: [new RegExp("CodeQL is out of memory.")],
},
[CliConfigErrorCategory.GradleBuildFailed]: { [CliConfigErrorCategory.GradleBuildFailed]: {
cliErrorMessageCandidates: [ cliErrorMessageCandidates: [
new RegExp("[autobuild] FAILURE: Build failed with an exception."), new RegExp("[autobuild] FAILURE: Build failed with an exception."),
@ -220,6 +225,13 @@ export const cliErrorsConfig: Record<
new RegExp("No supported build system detected"), new RegExp("No supported build system detected"),
], ],
}, },
[CliConfigErrorCategory.PackCannotBeFound]: {
cliErrorMessageCandidates: [
new RegExp(
"Query pack .* cannot be found\\. Check the spelling of the pack\\.",
),
],
},
[CliConfigErrorCategory.SwiftBuildFailed]: { [CliConfigErrorCategory.SwiftBuildFailed]: {
cliErrorMessageCandidates: [ cliErrorMessageCandidates: [
new RegExp( new RegExp(

View file

@ -775,6 +775,8 @@ function shouldConsiderInvalidRequest(processingErrors: string[]): boolean {
return processingErrors.every( return processingErrors.every(
(error) => (error) =>
error.startsWith("rejecting SARIF") || error.startsWith("rejecting SARIF") ||
error.startsWith("an invalid URI was provided as a SARIF location") ||
error.startsWith("locationFromSarifResult: expected artifact location") ||
error.startsWith( error.startsWith(
"could not convert rules: invalid security severity value, is not a number", "could not convert rules: invalid security severity value, is not a number",
) || ) ||