diff --git a/utils/curl/client_resty.go b/utils/curl/client_resty.go index 8542ea80..6cb0423f 100644 --- a/utils/curl/client_resty.go +++ b/utils/curl/client_resty.go @@ -3,7 +3,7 @@ package curl import ( "bytes" "context" - "errors" + "fmt" "time" "github.com/go-resty/resty/v2" @@ -87,7 +87,7 @@ func (c *defaultClient) PostJson(jsonData interface{}, res interface{}) error { //logc.Infof(c.ctx, "客户端 请求返回结果 Client PostForm res result:%+v", res) if resp.StatusCode() != 200 { - err = errors.New("服务端失败") + err = fmt.Errorf("服务端失败,返回结果:%+v", resp.RawResponse.Status) logx.Errorf("客户端 请求失败 Client PostForm Server error:%+v", err) } return err @@ -111,7 +111,7 @@ func (c *defaultClient) PostForm(formData map[string]string, res interface{}) (i logc.Infof(c.ctx, "客户端 请求返回结果 Client PostForm RawResponse result:%+v,%+V", resp.RawResponse.Status, resp.RawResponse.StatusCode) logc.Infof(c.ctx, "客户端 请求返回结果 Client PostForm res result:%+v", res) if resp.StatusCode() != 200 { - err = errors.New("服务端失败") + err = fmt.Errorf("服务端失败,返回结果:%+v", resp.RawResponse.Status) logx.Errorf("客户端 请求失败 Client PostForm Server error:%+v", err) } return res, err @@ -137,7 +137,7 @@ func (c *defaultClient) PostFile(fileParam string, fileName string, res interfac logc.Infof(c.ctx, "客户端 请求返回结果 Client PostFile RawResponse result:%+v,%+V", resp.RawResponse.Status, resp.RawResponse.StatusCode) logc.Infof(c.ctx, "客户端 请求返回结果 Client PostFile res result:%+v", res) if resp.StatusCode() != 200 { - err = errors.New("服务端失败") + err = fmt.Errorf("服务端失败,返回结果:%+v", resp.RawResponse.Status) logx.Errorf("客户端 请求失败 Client PostFile Server error:%+v", err) } return res, err