From ec32d36cab976d074493d8a53e24c058a92f5a1f Mon Sep 17 00:00:00 2001 From: Marco Munizaga Date: Wed, 5 Jul 2023 11:59:03 -0700 Subject: [PATCH] Add debug logging if JSON parse fails (#223) --- multidim-interop/src/compose-runner.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/multidim-interop/src/compose-runner.ts b/multidim-interop/src/compose-runner.ts index ee32ea1..267ab81 100644 --- a/multidim-interop/src/compose-runner.ts +++ b/multidim-interop/src/compose-runner.ts @@ -55,8 +55,19 @@ export async function run(namespace: string, compose: ComposeSpecification, opts if (testResults === null || testResults.length < 2) { throw new Error("Test JSON results not found") } - const testResultsParsed = JSON.parse(testResults[1]) - console.log("Finished:", namespace, testResultsParsed) + try { + const testResultsParsed = JSON.parse(testResults[1]) + console.log("Finished:", namespace, testResultsParsed) + } catch (e) { + console.log("Failed to parse test results:", testResults[1]) + console.log("stdout:") + console.log(stdout) + console.log("") + console.log("stderr:") + console.log(stderr) + console.log("") + throw e + } } catch (e: any) { console.log("Failure", e) return e