Merge remote-tracking branch 'upstream/main' into aeisenberg/ff-refactoring
This commit is contained in:
commit
919e4caca1
12 changed files with 86 additions and 47 deletions
|
|
@ -66,7 +66,7 @@ for (const variant of ALL_FEATURE_FLAGS_DISABLED_VARIANTS) {
|
|||
(v: LoggedMessage) =>
|
||||
v.type === "debug" &&
|
||||
v.message ===
|
||||
"Not running against github.com. Disabling all feature flags."
|
||||
"Not running against github.com. Disabling all toggleable features."
|
||||
) !== undefined
|
||||
);
|
||||
});
|
||||
|
|
@ -122,7 +122,7 @@ test("Feature flags exception is propagated if the API request errors", async (t
|
|||
),
|
||||
{
|
||||
message:
|
||||
"Encountered an error while trying to load feature flags: Error: some error message",
|
||||
"Encountered an error while trying to determine feature enablement: Error: some error message",
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
@ -217,7 +217,7 @@ for (const featureFlag of Object.keys(featureConfig)) {
|
|||
await t.throwsAsync(
|
||||
async () => featureFlags.getValue(featureFlag as Feature),
|
||||
{
|
||||
message: `Internal error: A minimum version is specified for feature flag ${featureFlag}, but no instance of CodeQL was provided.`,
|
||||
message: `Internal error: A minimum version is specified for feature ${featureFlag}, but no instance of CodeQL was provided.`,
|
||||
}
|
||||
);
|
||||
});
|
||||
|
|
|
|||
55
src/init.ts
55
src/init.ts
|
|
@ -117,24 +117,7 @@ export async function runInit(
|
|||
}
|
||||
}
|
||||
} catch (e) {
|
||||
// Handle the situation where init is called twice
|
||||
// for the same database in the same job.
|
||||
if (
|
||||
e instanceof Error &&
|
||||
e.message?.includes("Refusing to create databases") &&
|
||||
e.message.includes("exists and is not an empty directory.")
|
||||
) {
|
||||
throw new util.UserError(
|
||||
`Is the "init" action called twice in the same job? ${e.message}`
|
||||
);
|
||||
} else if (
|
||||
e instanceof Error &&
|
||||
e.message?.includes("is not compatible with this CodeQL CLI")
|
||||
) {
|
||||
throw new util.UserError(e.message);
|
||||
} else {
|
||||
throw e;
|
||||
}
|
||||
throw processError(e);
|
||||
}
|
||||
return await getCombinedTracerConfig(
|
||||
config,
|
||||
|
|
@ -144,6 +127,42 @@ export async function runInit(
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Possibly convert this error into a UserError in order to avoid
|
||||
* counting this error towards our internal error budget.
|
||||
*
|
||||
* @param e The error to possibly convert to a UserError.
|
||||
*
|
||||
* @returns A UserError if the error is a known error that can be
|
||||
* attributed to the user, otherwise the original error.
|
||||
*/
|
||||
function processError(e: any): Error {
|
||||
if (!(e instanceof Error)) {
|
||||
return e;
|
||||
}
|
||||
|
||||
if (
|
||||
// Init action called twice
|
||||
e.message?.includes("Refusing to create databases") &&
|
||||
e.message?.includes("exists and is not an empty directory.")
|
||||
) {
|
||||
return new util.UserError(
|
||||
`Is the "init" action called twice in the same job? ${e.message}`
|
||||
);
|
||||
}
|
||||
|
||||
if (
|
||||
// Version of CodeQL CLI is incompatible with this version of the CodeQL Action
|
||||
e.message?.includes("is not compatible with this CodeQL CLI") ||
|
||||
// Expected source location for database creation does not exist
|
||||
e.message?.includes("Invalid source root")
|
||||
) {
|
||||
return new util.UserError(e.message);
|
||||
}
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
// Runs a powershell script to inject the tracer into a parent process
|
||||
// so it can tracer future processes, hopefully including the build process.
|
||||
// If processName is given then injects into the nearest parent process with
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue