Improved Error handling without panics

This commit is contained in:
Alex Lovell-Troy 2024-07-01 13:53:32 -04:00
parent 3386690f17
commit fdc574f5f2
No known key found for this signature in database
2 changed files with 9 additions and 1 deletions

View file

@ -3,6 +3,7 @@ package cmd
import (
"encoding/json"
"fmt"
"log"
"net/url"
"github.com/OpenCHAMI/magellan/pkg/crawler"
@ -31,7 +32,7 @@ var crawlCmd = &cobra.Command{
Insecure: cmd.Flag("insecure").Value.String() == "true",
})
if err != nil {
panic(err)
log.Fatalf("Error crawling BMC: %v", err)
}
// Marshal the inventory details to JSON
jsonData, err := json.MarshalIndent(systems, "", " ")