From 6d9704bbafb216d105285527f9bfed4c1038a844 Mon Sep 17 00:00:00 2001 From: Branden Clark Date: Wed, 22 Nov 2023 12:18:50 -0500 Subject: [PATCH 1/2] render LastError on agent gui even when not JSON --- cmd/agent/gui/render.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cmd/agent/gui/render.go b/cmd/agent/gui/render.go index 76a7e0184981c..4a719bc566f21 100644 --- a/cmd/agent/gui/render.go +++ b/cmd/agent/gui/render.go @@ -137,15 +137,15 @@ func lastErrorTraceback(value string) template.HTML { return template.HTML(traceback) } -func lastErrorMessage(value string) string { +func lastErrorMessage(value string) template.HTML { var lastErrorArray []map[string]string err := json.Unmarshal([]byte(value), &lastErrorArray) if err == nil && len(lastErrorArray) > 0 { if msg, ok := lastErrorArray[0]["message"]; ok { - return msg + value = msg } } - return "UNKNOWN ERROR" + return template.HTML(template.HTMLEscapeString(value)) } func displayStatus(check map[string]interface{}) template.HTML { From 6a53281c65f4e3d22f1751ad7243d1723ae78ac0 Mon Sep 17 00:00:00 2001 From: Branden Clark Date: Thu, 4 Jan 2024 16:35:23 -0500 Subject: [PATCH 2/2] changelog --- .../show-go-check-error-in-agent-gui-fc4f1de1b942d710.yaml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 releasenotes/notes/show-go-check-error-in-agent-gui-fc4f1de1b942d710.yaml diff --git a/releasenotes/notes/show-go-check-error-in-agent-gui-fc4f1de1b942d710.yaml b/releasenotes/notes/show-go-check-error-in-agent-gui-fc4f1de1b942d710.yaml new file mode 100644 index 0000000000000..d785156756202 --- /dev/null +++ b/releasenotes/notes/show-go-check-error-in-agent-gui-fc4f1de1b942d710.yaml @@ -0,0 +1,5 @@ +--- +fixes: + - | + Error messages from Go checks are now shown on the Agent GUI status page + instead of ``UNKNOWN ERROR``.