feat: add err return

This commit is contained in:
liruichen 2023-09-15 10:59:28 +08:00
parent f9867d9c22
commit 6dd2d9082a

View File

@ -15,6 +15,7 @@ package agent
import ( import (
"encoding/json" "encoding/json"
"fmt"
"strings" "strings"
"github.com/go-resty/resty/v2" "github.com/go-resty/resty/v2"
@ -72,7 +73,7 @@ func (a *agentsClient) Get(ids []string) ([]Agent, error) {
err = json.Unmarshal(resp.Body(), &res) err = json.Unmarshal(resp.Body(), &res)
if err != nil { if err != nil {
return nil, err return nil, fmt.Errorf("unmarshal response body failed: %v, resp body: %v", err, string(resp.Body()))
} }
return res.Items, nil return res.Items, nil