feat: add err return
This commit is contained in:
parent
f9867d9c22
commit
6dd2d9082a
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user