From b3b41c07952a666532072743c992472b5a8a5038 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E3=83=9E=E3=83=AA=E3=82=A6=E3=82=B9?= Date: Wed, 31 Jul 2024 14:53:56 -0500 Subject: [PATCH] Fix #63, rm panic for loadSystems, add log info --- cmd/root.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cmd/root.go b/cmd/root.go index 116c04a..eada655 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -94,7 +94,8 @@ func loadSystems(c *ctx.Ctx) []error { sysCfg.Config["proxy"] = CFG.Proxy sys, err := system.New(sysCfg.Type, &sysCfg.Config, LOG) if err != nil { - c.Logger.Errorf("error loading system: %s", err) + c.Logger.Errorf("error loading system %s: %s", sysCfg.Type, err) + c.Logger.Infof("system %s won't be available due to errors", sysCfg.Type) errs = append(errs, err) } else { c.Logger.Debugf("loaded %s system", sysCfg.Type) @@ -120,13 +121,7 @@ var rootCmd = &cobra.Command{ var err error c := ctx.New(EMBEDFS, &CFG, LOG) - errs := loadSystems(&c) - if len(errs) > 0 { - for _, err = range errs { - c.Logger.Error(err) - } - panic("Error(s) loading system(s)") - } + _ = loadSystems(&c) tui := tea.NewProgram(ui.NewModel(&c), tea.WithAltScreen()) err = tui.Start()