Compare commits
No commits in common. "6f7802b58cf52e1dc65fdf6175515859244b63b1" and "8d4fbb9c2ef4bd29a36394afeb4572c8953515b0" have entirely different histories.
6f7802b58c
...
8d4fbb9c2e
@ -27,15 +27,6 @@ var (
|
||||
logg = logging.NewVanilla().WithDomain("sarafu-api.devapi")
|
||||
)
|
||||
|
||||
type APIError struct {
|
||||
Code string
|
||||
Description string
|
||||
}
|
||||
|
||||
func (e *APIError) Error() string {
|
||||
return e.Description
|
||||
}
|
||||
|
||||
type HTTPAccountService struct {
|
||||
SS storage.StorageService
|
||||
UseApi bool
|
||||
@ -771,11 +762,7 @@ func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKRespons
|
||||
if err := json.Unmarshal(body, &errResponse); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
return nil, &APIError{
|
||||
Code: errResponse.ErrCode,
|
||||
Description: errResponse.Description,
|
||||
}
|
||||
return nil, errors.New(errResponse.Description)
|
||||
}
|
||||
|
||||
if err := json.Unmarshal(body, &okResponse); err != nil {
|
||||
@ -783,7 +770,7 @@ func doRequest(ctx context.Context, req *http.Request, rcpt any) (*api.OKRespons
|
||||
}
|
||||
|
||||
if len(okResponse.Result) == 0 {
|
||||
return nil, errors.New("empty api result")
|
||||
return nil, errors.New("Empty api result")
|
||||
}
|
||||
|
||||
v, err := json.Marshal(okResponse.Result)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user