Skip to content

Commit 929f5c0

Browse files
committed
Move isDiskConfigurationError out of codeql.ts
1 parent a76419a commit 929f5c0

3 files changed

Lines changed: 34 additions & 31 deletions

File tree

‎lib/entry-points.js‎

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

‎src/codeql.ts‎

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import type { ActionConfig } from "./config/action-config";
1919
import { appendExtraQueryExclusions, type Config } from "./config-utils";
2020
import { DocUrl } from "./doc-url";
2121
import { EnvVar, getEnv, exportEnvVar } from "./environment";
22+
import { getErrorMessage, isDiskConfigurationError } from "./errors";
2223
import {
2324
CodeQLDefaultVersionInfo,
2425
Feature,
@@ -34,7 +35,9 @@ import { ToolsDownloadStatusReport } from "./tools-download";
3435
import { ToolsFeature, isSupportedToolsFeature } from "./tools-features";
3536
import { shouldEnableIndirectTracing } from "./tracer-config";
3637
import * as util from "./util";
37-
import { BuildMode, CleanupLevel, getErrorMessage } from "./util";
38+
import { BuildMode, CleanupLevel } from "./util";
39+
40+
export { isDiskConfigurationError } from "./errors";
3841

3942
type Options = Array<string | number | boolean>;
4043

@@ -274,26 +277,6 @@ const GHES_MOST_RECENT_DEPRECATION_DATE = "2026-09-24";
274277
/** The CLI verbosity level to use for extraction in debug mode. */
275278
const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++";
276279

277-
/**
278-
* Decides whether `e` is a disk-related error outside of our control
279-
* that should be classified as a `ConfigurationError`.
280-
*
281-
* @param e The error to check.
282-
* @returns True if the error should be treated as a `ConfigurationError` or false if not.
283-
*/
284-
export function isDiskConfigurationError(e: unknown): boolean {
285-
if (!(e instanceof Error)) {
286-
return false;
287-
}
288-
289-
return (
290-
// out of disk space
291-
e.message.includes("ENOSPC") ||
292-
// access denied
293-
e.message.includes("EACCES")
294-
);
295-
}
296-
297280
/**
298281
* Set up CodeQL CLI access.
299282
*

‎src/errors/index.ts‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,26 @@ export function getErrorMessage(error: unknown): string {
1818
return error instanceof Error ? error.message : String(error);
1919
}
2020

21+
/**
22+
* Decides whether `e` is a disk-related error outside of our control
23+
* that should be classified as a `ConfigurationError`.
24+
*
25+
* @param e The error to check.
26+
* @returns True if the error should be treated as a `ConfigurationError` or false if not.
27+
*/
28+
export function isDiskConfigurationError(e: unknown): boolean {
29+
if (!(e instanceof Error)) {
30+
return false;
31+
}
32+
33+
return (
34+
// out of disk space
35+
e.message.includes("ENOSPC") ||
36+
// access denied
37+
e.message.includes("EACCES")
38+
);
39+
}
40+
2141
/**
2242
* An Error class that indicates an error that occurred due to
2343
* a misconfiguration of the action or the CodeQL CLI.

0 commit comments

Comments
 (0)