feat: check executor & parser name

This commit is contained in:
张泊明518370910136 2024-03-12 16:20:14 -04:00
parent 8e49684abe
commit a5643c1556
GPG Key ID: D47306D7062CDA9D

View File

@ -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)