From 34aabe476076b8e36aee1e3ca51db0995b0e1868 Mon Sep 17 00:00:00 2001 From: Kroese Date: Thu, 14 Dec 2023 08:41:18 +0100 Subject: [PATCH] Better error handling --- index.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/index.js b/index.js index ab15183..192e047 100644 --- a/index.js +++ b/index.js @@ -30,15 +30,22 @@ async function run() { if (getRefResponse.status === 200) { console.log("Tag was found"); exists = 'true'; + } else { + core.setFailed("Unknown status was returned: " + getRefResponse.status); } } catch(error) { - console.log("Tag was not found"); + if (error.status === 404) { + console.log("Tag was not found"); + } else { + core.setFailed("Unknown status was returned: " + error.status); + console.error(error); + } } - core.setOutput('exists', exists); } catch (error) { core.setFailed(error.message); + console.error(error); } }