From 4f14649ced8f66194bb99aec11a934df5eea5af8 Mon Sep 17 00:00:00 2001 From: "Michael B. Gale" Date: Sun, 12 Oct 2025 13:27:59 +0100 Subject: [PATCH] Add additional regex to `CliConfigErrorCategory.PackCannotBeFound` --- lib/analyze-action-post.js | 3 +++ lib/analyze-action.js | 3 +++ lib/autobuild-action.js | 3 +++ lib/init-action-post.js | 3 +++ lib/init-action.js | 3 +++ lib/resolve-environment-action.js | 3 +++ lib/start-proxy-action-post.js | 3 +++ lib/upload-lib.js | 3 +++ lib/upload-sarif-action-post.js | 3 +++ lib/upload-sarif-action.js | 3 +++ src/cli-errors.test.ts | 14 ++++++++++++++ src/cli-errors.ts | 3 +++ 12 files changed, 47 insertions(+) diff --git a/lib/analyze-action-post.js b/lib/analyze-action-post.js index 6cf2b7a81..f495b674f 100644 --- a/lib/analyze-action-post.js +++ b/lib/analyze-action-post.js @@ -118773,6 +118773,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/analyze-action.js b/lib/analyze-action.js index 6a61b09b9..b188052d8 100644 --- a/lib/analyze-action.js +++ b/lib/analyze-action.js @@ -90599,6 +90599,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/autobuild-action.js b/lib/autobuild-action.js index 89570ece4..f14b14c17 100644 --- a/lib/autobuild-action.js +++ b/lib/autobuild-action.js @@ -79515,6 +79515,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/init-action-post.js b/lib/init-action-post.js index 2fdc6b6ed..26f324303 100644 --- a/lib/init-action-post.js +++ b/lib/init-action-post.js @@ -128830,6 +128830,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/init-action.js b/lib/init-action.js index d9ad48891..0ea051433 100644 --- a/lib/init-action.js +++ b/lib/init-action.js @@ -90063,6 +90063,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/resolve-environment-action.js b/lib/resolve-environment-action.js index ec752873a..868829e9a 100644 --- a/lib/resolve-environment-action.js +++ b/lib/resolve-environment-action.js @@ -79514,6 +79514,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/start-proxy-action-post.js b/lib/start-proxy-action-post.js index aa10b87db..a1934501c 100644 --- a/lib/start-proxy-action-post.js +++ b/lib/start-proxy-action-post.js @@ -118884,6 +118884,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/upload-lib.js b/lib/upload-lib.js index d0f1b1743..bae54aaa8 100644 --- a/lib/upload-lib.js +++ b/lib/upload-lib.js @@ -88971,6 +88971,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/upload-sarif-action-post.js b/lib/upload-sarif-action-post.js index e5d26e7a7..911c8c2ed 100644 --- a/lib/upload-sarif-action-post.js +++ b/lib/upload-sarif-action-post.js @@ -118614,6 +118614,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/lib/upload-sarif-action.js b/lib/upload-sarif-action.js index 720331fd2..cc36c1e7d 100644 --- a/lib/upload-sarif-action.js +++ b/lib/upload-sarif-action.js @@ -90224,6 +90224,9 @@ var cliErrorsConfig = { cliErrorMessageCandidates: [ new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\." + ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification." ) ] }, diff --git a/src/cli-errors.test.ts b/src/cli-errors.test.ts index a2c346ea9..58ebfa2c4 100644 --- a/src/cli-errors.test.ts +++ b/src/cli-errors.test.ts @@ -310,6 +310,20 @@ test("wrapCliConfigurationError - pack cannot be found", (t) => { t.true(wrappedError instanceof ConfigurationError); }); +test("wrapCliConfigurationError - unknown query file", (t) => { + const commandError = new CommandInvocationError( + "codeql", + ["database", "init"], + 2, + "my-query-file is not a .ql file, .qls file, a directory, or a query pack specification. See the logs for more details.", + ); + const cliError = new CliError(commandError); + + const wrappedError = wrapCliConfigurationError(cliError); + + t.true(wrappedError instanceof ConfigurationError); +}); + test("wrapCliConfigurationError - pack missing auth", (t) => { const commandError = new CommandInvocationError( "codeql", diff --git a/src/cli-errors.ts b/src/cli-errors.ts index 3d1b262dd..0a009f983 100644 --- a/src/cli-errors.ts +++ b/src/cli-errors.ts @@ -264,6 +264,9 @@ export const cliErrorsConfig: Record< new RegExp( "Query pack .* cannot be found\\. Check the spelling of the pack\\.", ), + new RegExp( + "is not a .ql file, .qls file, a directory, or a query pack specification.", + ), ], }, [CliConfigErrorCategory.PackMissingAuth]: {