Move isDiskConfigurationError out of codeql.ts

This commit is contained in:
Michael B. Gale
2026-10-16 21:50:09 +01:00
parent a76419a632
commit 929f5c0db4
3 changed files with 34 additions and 31 deletions

20
lib/entry-points.js generated
View File

@@ -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 {

View File

@@ -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<string | number | boolean>;
@@ -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.
*

View File

@@ -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.