From 7f67a8bb98cf8b48a20f66d65e41396680c18ae3 Mon Sep 17 00:00:00 2001 From: dawn Date: Mon, 06 Jul 2026 15:38:14 +0000 Subject: [PATCH] types/pipeline: restore ErrorMessage and ErrorDetails Signed-off-by: dawn --- types/pipeline.go | 19 +++++++++++++++++++ 1 file(s) changed, 19 insertion(s)(+), 0 deletion(s)(-) diff --git a/types/pipeline.go b/types/pipeline.go --- a/types/pipeline.go +++ b/types/pipeline.go @@ -46,6 +46,25 @@ return *w.CiPipeline_Workflow.Error } +func (w WorkflowStatus) ErrorMessage() string { + line, _, _ := strings.Cut(w.Error(), "\n") + return line +} + +func (w WorkflowStatus) ErrorDetails() string { + _, rest, _ := strings.Cut(w.Error(), "\n") + if rest == "" { + return "" + } + + const truncateTo = 15 + lines := strings.Split(rest, "\n") + if len(lines) <= truncateTo { + return rest + } + return strings.Join(lines[:truncateTo], "\n") + "\n…" +} + func (w WorkflowStatus) Status() StatusKind { if w.CiPipeline_Workflow == nil { return "" -- tangled.sh