From 8cbc57b00873051870916ad4e967b0f91829486b Mon Sep 17 00:00:00 2001 From: Gabriel Hernandez Date: Mon, 6 Jan 2025 17:35:29 +0000 Subject: [PATCH] fix the secret error message for windows profile (#25171) relates to #25155 fixes an issue where we weren't showing an error message for a windows profile with incorrect secret - [x] Manual QA for all new/changed functionality --- frontend/pages/SoftwarePage/helpers.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/frontend/pages/SoftwarePage/helpers.ts b/frontend/pages/SoftwarePage/helpers.ts index 48901f0efc52..a323982309b5 100644 --- a/frontend/pages/SoftwarePage/helpers.ts +++ b/frontend/pages/SoftwarePage/helpers.ts @@ -20,8 +20,11 @@ export const generateSecretErrMsg = (err: unknown) => { } if (errorType === "profile") { - return reason - .split(":")[1] + // for profiles we can get two different error messages. One contains a colon + // and the other doesn't. We need to handle both cases. + const message = reason.split(":").pop() ?? ""; + + return message .replace(/Secret variables?/i, "Variable") .replace("missing from database", "doesn't exist."); }