1
0
mirror of https://github.com/mrusme/neonmodem.git synced 2024-12-04 14:46:37 -05:00

Fix #63, rm panic for loadSystems, add log info

This commit is contained in:
マリウス 2024-07-31 14:53:56 -05:00
parent 615d531f7e
commit b3b41c0795
No known key found for this signature in database
GPG Key ID: 272ED814BF63261F

View File

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