collect the errors from group runner

This commit is contained in:
Roman Perekhod
2025-06-10 18:21:49 +02:00
parent a5c524423d
commit 4fc4822696
43 changed files with 241 additions and 217 deletions

View File

@@ -130,14 +130,14 @@ func Server(cfg *config.Config) *cli.Command {
gr.Add(runner.NewGoMicroHttpServerRunner("auth-app_http", server))
}
logger.Warn().Msgf("starting service %s", cfg.Service.Name)
grResults := gr.Run(ctx)
// return the first non-nil error found in the results
for _, grResult := range grResults {
if grResult.RunnerError != nil {
return grResult.RunnerError
}
if err := runner.ProcessResults(grResults); err != nil {
logger.Error().Err(err).Msgf("service %s stopped with error", cfg.Service.Name)
return err
}
logger.Warn().Msgf("service %s stopped without error", cfg.Service.Name)
return nil
},
}