From 7f67a8bb98cf8b48a20f66d65e41396680c18ae3 Mon Sep 17 00:00:00 2001 From: dawn Date: Mon, 6 Jul 2026 18:38:14 +0300 Subject: [PATCH] types/pipeline: restore ErrorMessage and ErrorDetails Signed-off-by: dawn --- types/pipeline.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/types/pipeline.go b/types/pipeline.go index 3f9ecdf6..c4cf5c03 100644 --- a/types/pipeline.go +++ b/types/pipeline.go @@ -46,6 +46,25 @@ func (w WorkflowStatus) Error() string { 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 "" -- 2.51.2