diff --git a/lib/entry-points.js b/lib/entry-points.js index c79607d1c..7fdec233b 100644 --- a/lib/entry-points.js +++ b/lib/entry-points.js @@ -169562,6 +169562,16 @@ function wrapError(error3) { function getErrorMessage(error3) { return error3 instanceof Error ? error3.message : String(error3); } +function isDiskConfigurationError(e) { + if (!(e instanceof Error)) { + return false; + } + return ( + // out of disk space + e.message.includes("ENOSPC") || // access denied + e.message.includes("EACCES") + ); +} var ConfigurationError = class extends Error { }; var HTTPError = class extends Error { @@ -177004,16 +177014,6 @@ var CODEQL_NEXT_MINIMUM_VERSION = "2.21.3"; var GHES_VERSION_MOST_RECENTLY_DEPRECATED = "3.17"; var GHES_MOST_RECENT_DEPRECATION_DATE = "2026-09-24"; var EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++"; -function isDiskConfigurationError(e) { - if (!(e instanceof Error)) { - return false; - } - return ( - // out of disk space - e.message.includes("ENOSPC") || // access denied - e.message.includes("EACCES") - ); -} async function setupCodeQL(toolsInput, apiDetails, tempDir, variant, defaultCliVersion, rawLanguages, otherLanguagePacksReason, useOverlayAwareDefaultCliVersion, features, logger2, checkVersion) { try { const { diff --git a/src/codeql.ts b/src/codeql.ts index a76e29727..706ca3210 100644 --- a/src/codeql.ts +++ b/src/codeql.ts @@ -19,6 +19,7 @@ import type { ActionConfig } from "./config/action-config"; import { appendExtraQueryExclusions, type Config } from "./config-utils"; import { DocUrl } from "./doc-url"; import { EnvVar, getEnv, exportEnvVar } from "./environment"; +import { getErrorMessage, isDiskConfigurationError } from "./errors"; import { CodeQLDefaultVersionInfo, Feature, @@ -34,7 +35,9 @@ import { ToolsDownloadStatusReport } from "./tools-download"; import { ToolsFeature, isSupportedToolsFeature } from "./tools-features"; import { shouldEnableIndirectTracing } from "./tracer-config"; import * as util from "./util"; -import { BuildMode, CleanupLevel, getErrorMessage } from "./util"; +import { BuildMode, CleanupLevel } from "./util"; + +export { isDiskConfigurationError } from "./errors"; type Options = Array; @@ -274,26 +277,6 @@ const GHES_MOST_RECENT_DEPRECATION_DATE = "2026-09-24"; /** The CLI verbosity level to use for extraction in debug mode. */ const EXTRACTION_DEBUG_MODE_VERBOSITY = "progress++"; -/** - * Decides whether `e` is a disk-related error outside of our control - * that should be classified as a `ConfigurationError`. - * - * @param e The error to check. - * @returns True if the error should be treated as a `ConfigurationError` or false if not. - */ -export function isDiskConfigurationError(e: unknown): boolean { - if (!(e instanceof Error)) { - return false; - } - - return ( - // out of disk space - e.message.includes("ENOSPC") || - // access denied - e.message.includes("EACCES") - ); -} - /** * Set up CodeQL CLI access. * diff --git a/src/errors/index.ts b/src/errors/index.ts index b1281f3af..24ce40d18 100644 --- a/src/errors/index.ts +++ b/src/errors/index.ts @@ -18,6 +18,26 @@ export function getErrorMessage(error: unknown): string { return error instanceof Error ? error.message : String(error); } +/** + * Decides whether `e` is a disk-related error outside of our control + * that should be classified as a `ConfigurationError`. + * + * @param e The error to check. + * @returns True if the error should be treated as a `ConfigurationError` or false if not. + */ +export function isDiskConfigurationError(e: unknown): boolean { + if (!(e instanceof Error)) { + return false; + } + + return ( + // out of disk space + e.message.includes("ENOSPC") || + // access denied + e.message.includes("EACCES") + ); +} + /** * An Error class that indicates an error that occurred due to * a misconfiguration of the action or the CodeQL CLI.