From 12a8f207460a5099b41283369bfecc9b67b25039 Mon Sep 17 00:00:00 2001 From: Pavel Okhlopkov Date: Tue, 3 Mar 2026 19:37:27 +0300 Subject: [PATCH] remove parse json --- .../models/hooks/kind/batch_hook.go | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/pkg/module_manager/models/hooks/kind/batch_hook.go b/pkg/module_manager/models/hooks/kind/batch_hook.go index 8d7b57a6..abbaaaff 100644 --- a/pkg/module_manager/models/hooks/kind/batch_hook.go +++ b/pkg/module_manager/models/hooks/kind/batch_hook.go @@ -4,7 +4,6 @@ import ( "bytes" "context" "encoding/json" - "errors" "fmt" "log/slog" "os" @@ -187,22 +186,6 @@ func (h *BatchHook) Execute(ctx context.Context, configVersion string, bContext usage, err := cmd.RunAndLogLines(ctx, logLabels) result.Usage = usage if err != nil { - outputError := &sdkhook.Error{} - trimmed := strings.TrimPrefix(err.Error(), "stderr:") - - // Try to parse stderr as a JSON error from the SDK. - // If stderr contains non-JSON content (e.g. log lines before the JSON error), - // fall back to returning the raw stderr content as the error message. - jsonErr := json.NewDecoder(bytes.NewBufferString(trimmed)).Decode(outputError) - if jsonErr != nil { - h.Logger.Warn("json decode", slog.String("original", trimmed), log.Err(err)) - return result, fmt.Errorf("json decode: %w", jsonErr) - } - - if outputError.Message != "" { - return result, errors.New(outputError.Message) - } - return result, fmt.Errorf("run and log lines: %w", err) }