From a1767d31d6a3d690c1231641a6b22be2a6bf863b Mon Sep 17 00:00:00 2001 From: Sreejith Kulamgarath <163200718+sreejith-kulamgarath@users.noreply.github.com> Date: Sun, 16 Mar 2025 23:55:56 -0400 Subject: [PATCH] Print Status as well if api code fails The error status helps us to troubleshoot better. Currently the error message only shows the message which sometimes can be generic. For example: Error: An error occurred trying to create the status check: Invalid request. --- src/main.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main.js b/src/main.js index a5da387..9da7de8 100644 --- a/src/main.js +++ b/src/main.js @@ -106,7 +106,7 @@ async function createPrComment(markdown, updateCommentIfOneExists, commentIdenti core.info(`PR comment was updated. ID: ${response.data.id}.`); }) .catch(error => { - core.setFailed(`An error occurred trying to update the PR comment: ${error.message}`); + core.setFailed(`An error occurred trying to update the PR comment: ${error.message}. Status: {error.status}`); }); } else { core.info(`Creating a new PR comment...`); @@ -168,7 +168,7 @@ async function createStatusCheck(reportName, checkName, markdown, conclusion) { statusCheckId = response.data.id; }) .catch(error => { - core.setFailed(`An error occurred trying to create the status check: ${error.message}`); + core.setFailed(`An error occurred trying to create the status check: ${error.message}. Status: {error.status}`); }); return statusCheckId; }