Wrap JSON parse errors in getTracerConfigForCluster with context

This commit is contained in:
Michael B. Gale
2026-09-22 18:43:26 +01:00
parent a5c2338ec0
commit c0369726ee
2 changed files with 27 additions and 23 deletions

24
lib/entry-points.js generated
View File

@@ -152821,18 +152821,20 @@ async function endTracingForCluster(codeql, config, logger) {
}
}
async function getTracerConfigForCluster(config) {
const tracingEnvVariables = JSON.parse(
fs15.readFileSync(
path14.resolve(
config.dbLocation,
"temp/tracingEnvironment/start-tracing.json"
),
"utf8"
)
const filePath = path14.resolve(
config.dbLocation,
"temp/tracingEnvironment/start-tracing.json"
);
return {
env: tracingEnvVariables
};
try {
const tracingEnvVariables = JSON.parse(fs15.readFileSync(filePath, "utf8"));
return {
env: tracingEnvVariables
};
} catch (err) {
throw new Error(
`Failed to parse tracing environment from '${filePath}': ${getErrorMessage(err)}`
);
}
}
async function getCombinedTracerConfig(codeql, config) {
if (!await shouldEnableIndirectTracing(codeql, config)) {