Changed the wording of error messages slightly

This commit is contained in:
David J. Allen 2024-05-08 13:39:51 -06:00
parent cc7bad8b94
commit 0403b2bcbc
No known key found for this signature in database
GPG key ID: 717C593FF60A2ACC
11 changed files with 31 additions and 32 deletions

View file

@ -45,13 +45,13 @@ func QueryScannedPorts() error {
url := makeEndpointUrl("/scanned_ports")
_, body, err := util.MakeRequest(nil, url, "GET", nil, nil)
if err != nil {
return fmt.Errorf("could not discover assets: %v", err)
return fmt.Errorf("failed todiscover assets: %v", err)
}
// get data from JSON
var res map[string]any
if err := json.Unmarshal(body, &res); err != nil {
return fmt.Errorf("could not unmarshal response body: %v", err)
return fmt.Errorf("failed tounmarshal response body: %v", err)
}
data := res["data"]

View file

@ -79,7 +79,7 @@ func (c *Client) GetRedfishEndpoints(headers map[string]string, opts ...Option)
url := makeEndpointUrl("/Inventory/RedfishEndpoints")
_, body, err := c.MakeRequest(url, "GET", nil, headers)
if err != nil {
return fmt.Errorf("could not get endpoint: %v", err)
return fmt.Errorf("failed toget endpoint: %v", err)
}
// fmt.Println(res)
fmt.Println(string(body))
@ -90,7 +90,7 @@ func (c *Client) GetComponentEndpoint(xname string) error {
url := makeEndpointUrl("/Inventory/ComponentsEndpoints/" + xname)
res, body, err := c.MakeRequest(url, "GET", nil, nil)
if err != nil {
return fmt.Errorf("could not get endpoint: %v", err)
return fmt.Errorf("failed toget endpoint: %v", err)
}
fmt.Println(res)
fmt.Println(string(body))
@ -99,7 +99,7 @@ func (c *Client) GetComponentEndpoint(xname string) error {
func (c *Client) AddRedfishEndpoint(data []byte, headers map[string]string) error {
if data == nil {
return fmt.Errorf("could not add redfish endpoint: no data found")
return fmt.Errorf("failed toadd redfish endpoint: no data found")
}
// Add redfish endpoint via POST `/hsm/v2/Inventory/RedfishEndpoints` endpoint