From 28576d9764e04c28bf446039b1daac167ffd8802 Mon Sep 17 00:00:00 2001 From: eiffel-fl Date: Mon, 19 Dec 2022 12:15:48 +0100 Subject: [PATCH] Add caught error to core.setFailed() message. (#243) This will help user to diagnose their problems using Azure/login. Signed-off-by: Francis Laniel Signed-off-by: Francis Laniel Co-authored-by: Balaga Gayatri --- lib/main.js | 4 ++-- src/main.ts | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/main.js b/lib/main.js index 2643c2d2..90d9206a 100644 --- a/lib/main.js +++ b/lib/main.js @@ -214,10 +214,10 @@ function main() { } catch (error) { if (!isAzCLISuccess) { - core.setFailed("Az CLI Login failed. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"); + core.setFailed(`Az CLI Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows`); } else { - core.setFailed(`Azure PowerShell Login failed. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); + core.setFailed(`Azure PowerShell Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); } } finally { diff --git a/src/main.ts b/src/main.ts index 7b29de1a..9cd7141c 100644 --- a/src/main.ts +++ b/src/main.ts @@ -209,10 +209,10 @@ async function main() { } catch (error) { if (!isAzCLISuccess) { - core.setFailed("Az CLI Login failed. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"); + core.setFailed(`Az CLI Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); } else { - core.setFailed(`Azure PowerShell Login failed. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); + core.setFailed(`Azure PowerShell Login failed with ${error}. Please check the credentials and make sure az is installed on the runner. For more information refer https://aka.ms/create-secrets-for-GitHub-workflows"`); } } finally {