From e160fa420b3ab1e43b7127697ac4a01298ecf970 Mon Sep 17 00:00:00 2001 From: Dovid Gefen Date: Tue, 18 Jan 2022 10:05:10 +0200 Subject: [PATCH 1/5] Stringify error --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index e2fbb24..54ee735 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ const runTest = (wpt, url, options) => { return reject(err); } } catch (e) { - core.info(e); + core.info(JSON.stringify(e)); } }) }); @@ -82,7 +82,7 @@ async function renderComment(data) { body: markdown }); } catch (e) { - core.setFailed(`Action failed with error ${e}`); + core.setFailed(`Action failed with error ${JSON.stringify(e)}`); } } function collectData(results, runData) { @@ -186,12 +186,12 @@ async function run() { return; } } catch (e) { - core.setFailed(`Action failed with error ${e}`); + core.setFailed(`Action failed with error ${JSON.stringify(e)}`); } }); } catch (e) { - core.setFailed(`Action failed with error ${e}`); + core.setFailed(`Action failed with error ${JSON.stringify(e)}`); } })).then(() => { if (isReportSupported()) { From 5b0d24dc1df6c57b425db30b9467f02c4bc22ea9 Mon Sep 17 00:00:00 2001 From: Dovid Gefen Date: Tue, 18 Jan 2022 11:14:35 +0200 Subject: [PATCH 2/5] Log error status message instead of object --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 54ee735..401f878 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ const runTest = (wpt, url, options) => { return reject(err); } } catch (e) { - core.info(JSON.stringify(e)); + core.info(e.statusText); } }) }); @@ -82,7 +82,7 @@ async function renderComment(data) { body: markdown }); } catch (e) { - core.setFailed(`Action failed with error ${JSON.stringify(e)}`); + core.setFailed(`Action failed with error ${e.statusText}`); } } function collectData(results, runData) { @@ -186,12 +186,12 @@ async function run() { return; } } catch (e) { - core.setFailed(`Action failed with error ${JSON.stringify(e)}`); + core.setFailed(`Action failed with error ${e.statusText}`); } }); } catch (e) { - core.setFailed(`Action failed with error ${JSON.stringify(e)}`); + core.setFailed(`Action failed with error ${e.statusText}`); } })).then(() => { if (isReportSupported()) { From 0c87d55847ae88c5341eb1c0b5802fd6ed2f2f21 Mon Sep 17 00:00:00 2001 From: Dovid Gefen Date: Tue, 18 Jan 2022 11:27:29 +0200 Subject: [PATCH 3/5] Improve error message formatting --- index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index 401f878..9d12bba 100644 --- a/index.js +++ b/index.js @@ -186,12 +186,12 @@ async function run() { return; } } catch (e) { - core.setFailed(`Action failed with error ${e.statusText}`); + core.setFailed(`Action failed with error: ${e.statusText}`); } }); } catch (e) { - core.setFailed(`Action failed with error ${e.statusText}`); + core.setFailed(`Action failed with error: ${e.statusText}`); } })).then(() => { if (isReportSupported()) { From b5bbc71fef7f3b467e18bb7d2bab27cb879f6853 Mon Sep 17 00:00:00 2001 From: Dovid Gefen Date: Tue, 18 Jan 2022 11:49:45 +0200 Subject: [PATCH 4/5] Add missing formatting --- index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.js b/index.js index 9d12bba..2aff991 100644 --- a/index.js +++ b/index.js @@ -82,7 +82,7 @@ async function renderComment(data) { body: markdown }); } catch (e) { - core.setFailed(`Action failed with error ${e.statusText}`); + core.setFailed(`Action failed with error: ${e.statusText}`); } } function collectData(results, runData) { From 9d017e182a66f028879130a1d6da3259d3d36c90 Mon Sep 17 00:00:00 2001 From: Dovid Gefen Date: Mon, 24 Jan 2022 21:47:34 +0200 Subject: [PATCH 5/5] Fallback on JSON.stringify() when e.statusText is undefined --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 2aff991..5097984 100644 --- a/index.js +++ b/index.js @@ -38,7 +38,7 @@ const runTest = (wpt, url, options) => { return reject(err); } } catch (e) { - core.info(e.statusText); + core.info(e.statusText || JSON.stringify(e)); } }) }); @@ -82,7 +82,7 @@ async function renderComment(data) { body: markdown }); } catch (e) { - core.setFailed(`Action failed with error: ${e.statusText}`); + core.setFailed(`Action failed with error: ${e.statusText || JSON.stringify(e)}`); } } function collectData(results, runData) { @@ -186,12 +186,12 @@ async function run() { return; } } catch (e) { - core.setFailed(`Action failed with error: ${e.statusText}`); + core.setFailed(`Action failed with error: ${e.statusText || JSON.stringify(e)}`); } }); } catch (e) { - core.setFailed(`Action failed with error: ${e.statusText}`); + core.setFailed(`Action failed with error: ${e.statusText || JSON.stringify(e)}`); } })).then(() => { if (isReportSupported()) {