Wrap JSON parse errors in parseMatrixInput with context

This commit is contained in:
Michael B. Gale
2026-09-22 18:46:55 +01:00
parent c0369726ee
commit 2294a7a8b1
2 changed files with 14 additions and 2 deletions

8
lib/entry-points.js generated
View File

@@ -145995,7 +145995,13 @@ function parseMatrixInput(matrixInput) {
if (matrixInput === void 0 || matrixInput === "null") {
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) {
return error3 instanceof Error ? error3 : new Error(String(error3));

View File

@@ -894,7 +894,13 @@ export function parseMatrixInput(
if (matrixInput === undefined || matrixInput === "null") {
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 {