api-structs #117
@ -84,14 +84,17 @@ func (as *AccountService) TrackAccountStatus(publicKey string) (*api.OKResponse,
|
|||||||
errResponse.Description = err.Error()
|
errResponse.Description = err.Error()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = json.Unmarshal([]byte(body), &okResponse)
|
if resp.StatusCode >= http.StatusBadRequest {
|
||||||
if err != nil {
|
|
||||||
err := json.Unmarshal([]byte(body), &errResponse)
|
err := json.Unmarshal([]byte(body), &errResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, errors.New(errResponse.Description)
|
return nil, errors.New(errResponse.Description)
|
||||||
}
|
}
|
||||||
|
err = json.Unmarshal([]byte(body), &okResponse)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
|||||||
|
}
|
||||||
if len(okResponse.Result) == 0 {
|
if len(okResponse.Result) == 0 {
|
||||||
return nil, errors.New("Empty api result")
|
return nil, errors.New("Empty api result")
|
||||||
}
|
}
|
||||||
@ -148,15 +151,17 @@ func (as *AccountService) CreateAccount() (*api.OKResponse, error) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
err = json.Unmarshal([]byte(body), &okResponse)
|
if resp.StatusCode >= http.StatusBadRequest {
|
||||||
|
|
||||||
if err != nil {
|
|
||||||
err := json.Unmarshal([]byte(body), &errResponse)
|
err := json.Unmarshal([]byte(body), &errResponse)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
return nil, errors.New(errResponse.Description)
|
return nil, errors.New(errResponse.Description)
|
||||||
}
|
}
|
||||||
|
err = json.Unmarshal([]byte(body), &okResponse)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
if len(okResponse.Result) == 0 {
|
if len(okResponse.Result) == 0 {
|
||||||
return nil, errors.New("Empty api result")
|
return nil, errors.New("Empty api result")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user
I would just use the literal
0
hereIf there is no matching tracking id, result.otx will be null.
@kamikazechaser please elaborate is there a missing case?