From ac8472f51a64e7a3d84bfe41ac77320efe950c52 Mon Sep 17 00:00:00 2001
From: Michal Dorner <dorner.michal@gmail.com>
Date: Wed, 30 Nov 2022 18:49:10 +0100
Subject: [PATCH] Log filename if parsing fails

---
 dist/index.js | 12 +++++++++---
 src/main.ts   | 10 ++++++++--
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/dist/index.js b/dist/index.js
index df75f07..415c454 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -375,11 +375,17 @@ class TestReporter {
                 core.warning(`No file matches path ${this.path}`);
                 return [];
             }
+            core.info(`Processing test results for check run ${name}`);
             const results = [];
             for (const { file, content } of files) {
-                core.info(`Processing test results from ${file}`);
-                const tr = yield parser.parse(file, content);
-                results.push(tr);
+                try {
+                    const tr = yield parser.parse(file, content);
+                    results.push(tr);
+                }
+                catch (error) {
+                    core.error(`Processing test results from ${file} failed`);
+                    throw error;
+                }
             }
             core.info(`Creating check run ${name}`);
             const createResp = yield this.octokit.rest.checks.create(Object.assign({ head_sha: this.context.sha, name, status: 'in_progress', output: {
diff --git a/src/main.ts b/src/main.ts
index 6ee6810..825794f 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -147,10 +147,16 @@ class TestReporter {
       return []
     }
 
+    core.info(`Processing test results for check run ${name}`)
     const results: TestRunResult[] = []
     for (const {file, content} of files) {
-      const tr = await parser.parse(file, content)
-      results.push(tr)
+      try {
+        const tr = await parser.parse(file, content)
+        results.push(tr)
+      } catch (error) {
+        core.error(`Processing test results from ${file} failed`)
+        throw error
+      }
     }
 
     core.info(`Creating check run ${name}`)