Skip to content

Commit 2db5b5a

Browse files
authored
Merge pull request #2786 from github/henrymercer/more-config-errors
Add some more configuration errors
2 parents 8392354 + d59d0eb commit 2db5b5a

File tree

6 files changed

+22
-4
lines changed

6 files changed

+22
-4
lines changed

lib/cli-errors.js

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/cli-errors.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js

+5-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/codeql.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/cli-errors.ts

+4
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ function extractAutobuildErrors(error: string): string | undefined {
119119
/** Error messages from the CLI that we consider configuration errors and handle specially. */
120120
export enum CliConfigErrorCategory {
121121
AutobuildError = "AutobuildError",
122+
CouldNotCreateTempDir = "CouldNotCreateTempDir",
122123
ExternalRepositoryCloneFailed = "ExternalRepositoryCloneFailed",
123124
GradleBuildFailed = "GradleBuildFailed",
124125
IncompatibleWithActionVersion = "IncompatibleWithActionVersion",
@@ -159,6 +160,9 @@ export const cliErrorsConfig: Record<
159160
new RegExp("We were unable to automatically build your code"),
160161
],
161162
},
163+
[CliConfigErrorCategory.CouldNotCreateTempDir]: {
164+
cliErrorMessageCandidates: [new RegExp("Could not create temp directory")],
165+
},
162166
[CliConfigErrorCategory.ExternalRepositoryCloneFailed]: {
163167
cliErrorMessageCandidates: [
164168
new RegExp("Failed to clone external Git repository"),

src/codeql.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,13 @@ export async function setupCodeQL(
377377
zstdAvailability,
378378
};
379379
} catch (e) {
380-
throw new Error(
380+
const ErrorClass =
381+
e instanceof util.ConfigurationError ||
382+
(e instanceof Error && e.message.includes("ENOSPC")) // out of disk space
383+
? util.ConfigurationError
384+
: Error;
385+
386+
throw new ErrorClass(
381387
`Unable to download and extract CodeQL CLI: ${getErrorMessage(e)}${
382388
e instanceof Error && e.stack ? `\n\nDetails: ${e.stack}` : ""
383389
}`,

0 commit comments

Comments
 (0)