From a5643c1556c14e62ecf73307eb4903833dcb7f77 Mon Sep 17 00:00:00 2001 From: Boming Zhang Date: Tue, 12 Mar 2024 16:20:14 -0400 Subject: [PATCH] feat: check executor & parser name --- internal/stage/run.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/internal/stage/run.go b/internal/stage/run.go index da81992..92cd215 100644 --- a/internal/stage/run.go +++ b/internal/stage/run.go @@ -12,7 +12,11 @@ func Run(stages []Stage) []StageResult { for _, stage := range stages { slog.Debug("stage start", "name", stage.Name) slog.Debug("executor run start", "cmds", stage.ExecutorCmds) - executor := executorMap[stage.ExecutorName] + executor, ok := executorMap[stage.ExecutorName] + if !ok { + slog.Error("executor not found", "name", stage.ExecutorName) + break + } executorResults, err := executor.Run(stage.ExecutorCmds) if err != nil { slog.Error("executor run error", "name", stage.ExecutorName, "error", err) @@ -20,7 +24,11 @@ func Run(stages []Stage) []StageResult { } slog.Debug("executor run done", "results", executorResults) slog.Debug("parser run start", "conf", stage.ParserConf) - parser := parserMap[stage.ParserName] + parser, ok := parserMap[stage.ParserName] + if !ok { + slog.Error("parser not found", "name", stage.ParserName) + break + } parserResults, end, err := parser.Run(executorResults, stage.ParserConf) if err != nil { slog.Error("parser run error", "name", stage.ExecutorName, "error", err)