mirror of
https://github.com/github/codeql-action.git
synced 2026-10-03 17:41:28 +00:00
Wrap JSON parse errors in parseMatrixInput with context
This commit is contained in:
8
lib/entry-points.js
generated
8
lib/entry-points.js
generated
@@ -145995,7 +145995,13 @@ function parseMatrixInput(matrixInput) {
|
|||||||
if (matrixInput === void 0 || matrixInput === "null") {
|
if (matrixInput === void 0 || matrixInput === "null") {
|
||||||
return void 0;
|
return void 0;
|
||||||
}
|
}
|
||||||
return JSON.parse(matrixInput);
|
try {
|
||||||
|
return JSON.parse(matrixInput);
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to parse matrix input '${matrixInput}': ${getErrorMessage(err)}`
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
function wrapError(error3) {
|
function wrapError(error3) {
|
||||||
return error3 instanceof Error ? error3 : new Error(String(error3));
|
return error3 instanceof Error ? error3 : new Error(String(error3));
|
||||||
|
|||||||
@@ -894,7 +894,13 @@ export function parseMatrixInput(
|
|||||||
if (matrixInput === undefined || matrixInput === "null") {
|
if (matrixInput === undefined || matrixInput === "null") {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
return JSON.parse(matrixInput) as { [key: string]: string };
|
try {
|
||||||
|
return JSON.parse(matrixInput) as { [key: string]: string };
|
||||||
|
} catch (err) {
|
||||||
|
throw new Error(
|
||||||
|
`Failed to parse matrix input '${matrixInput}': ${getErrorMessage(err)}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function wrapError(error: unknown): Error {
|
export function wrapError(error: unknown): Error {
|
||||||
|
|||||||
Reference in New Issue
Block a user