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 sysCfg.Config["proxy"] = CFG.Proxy
sys, err := system.New(sysCfg.Type, &sysCfg.Config, LOG) sys, err := system.New(sysCfg.Type, &sysCfg.Config, LOG)
if err != nil { 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) errs = append(errs, err)
} else { } else {
c.Logger.Debugf("loaded %s system", sysCfg.Type) c.Logger.Debugf("loaded %s system", sysCfg.Type)
@ -120,13 +121,7 @@ var rootCmd = &cobra.Command{
var err error var err error
c := ctx.New(EMBEDFS, &CFG, LOG) c := ctx.New(EMBEDFS, &CFG, LOG)
errs := loadSystems(&c) _ = loadSystems(&c)
if len(errs) > 0 {
for _, err = range errs {
c.Logger.Error(err)
}
panic("Error(s) loading system(s)")
}
tui := tea.NewProgram(ui.NewModel(&c), tea.WithAltScreen()) tui := tea.NewProgram(ui.NewModel(&c), tea.WithAltScreen())
err = tui.Start() err = tui.Start()