mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 01:11:55 +08:00
fix: #849
This commit is contained in:
parent
b6c59c57de
commit
72cfe921d3
@ -103,8 +103,11 @@ func (c *Client) doRequestWithResult(req *resty.Request, res apiResponse) (*rest
|
||||
if err := json.Unmarshal(resp.Body(), &res); err != nil {
|
||||
return resp, fmt.Errorf("sdkerr: failed to unmarshal response: %w", err)
|
||||
} else {
|
||||
if tdata := res.GetData(); tdata == nil {
|
||||
return resp, fmt.Errorf("sdkerr: empty data")
|
||||
tresp := &apiResponseBase{}
|
||||
if err := json.Unmarshal(resp.Body(), &tresp); err != nil {
|
||||
return resp, fmt.Errorf("sdkerr: failed to unmarshal response: %w", err)
|
||||
} else if tdata := tresp.GetData(); tdata == nil {
|
||||
return resp, fmt.Errorf("sdkerr: received empty data")
|
||||
} else if terrcode := tdata.GetErrorCode(); terrcode != 0 {
|
||||
return resp, fmt.Errorf("sdkerr: code='%d', message='%s'", terrcode, tdata.GetMessage())
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user