mirror of
https://github.com/woodchen-ink/certimate.git
synced 2025-07-18 09:21:56 +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 {
|
if err := json.Unmarshal(resp.Body(), &res); err != nil {
|
||||||
return resp, fmt.Errorf("sdkerr: failed to unmarshal response: %w", err)
|
return resp, fmt.Errorf("sdkerr: failed to unmarshal response: %w", err)
|
||||||
} else {
|
} else {
|
||||||
if tdata := res.GetData(); tdata == nil {
|
tresp := &apiResponseBase{}
|
||||||
return resp, fmt.Errorf("sdkerr: empty data")
|
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 {
|
} else if terrcode := tdata.GetErrorCode(); terrcode != 0 {
|
||||||
return resp, fmt.Errorf("sdkerr: code='%d', message='%s'", terrcode, tdata.GetMessage())
|
return resp, fmt.Errorf("sdkerr: code='%d', message='%s'", terrcode, tdata.GetMessage())
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user