mirror of
https://github.com/d0zingcat/gocryptotrader.git
synced 2026-05-24 23:16:52 +00:00
common: update Errors type (#1129)
* common: adjust common error slice to allow multi errors.Is matching and conform to interface better * zb: forgot to save? * linties: fixies * linties: word change as well. * nitters: glorious * buts * nitters: fix glorious bug * Update common/common.go Co-authored-by: Scott <gloriousCode@users.noreply.github.com> * nitters: shifty --------- Co-authored-by: Ryan O'Hara-Reid <ryan.oharareid@thrasher.io> Co-authored-by: Scott <gloriousCode@users.noreply.github.com>
This commit is contained in:
@@ -541,31 +541,28 @@ func (g *Gateio) Subscribe(channelsToSubscribe []stream.ChannelSubscription) err
|
||||
return err
|
||||
}
|
||||
|
||||
var errs common.Errors
|
||||
var errs error
|
||||
for k := range payloads {
|
||||
resp, err := g.Websocket.Conn.SendMessageReturnResponse(payloads[k].ID, payloads[k])
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
errs = common.AppendError(errs, err)
|
||||
continue
|
||||
}
|
||||
var response WebsocketAuthenticationResponse
|
||||
err = json.Unmarshal(resp, &response)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
errs = common.AppendError(errs, err)
|
||||
continue
|
||||
}
|
||||
if response.Result.Status != "success" {
|
||||
errs = append(errs, fmt.Errorf("%v could not subscribe to %v",
|
||||
errs = common.AppendError(errs, fmt.Errorf("%v could not subscribe to %v",
|
||||
g.Name,
|
||||
payloads[k].Method))
|
||||
continue
|
||||
}
|
||||
g.Websocket.AddSuccessfulSubscriptions(payloads[k].Channels...)
|
||||
}
|
||||
if errs != nil {
|
||||
return errs
|
||||
}
|
||||
return nil
|
||||
return errs
|
||||
}
|
||||
|
||||
func (g *Gateio) generatePayload(channelsToSubscribe []stream.ChannelSubscription) ([]WebsocketRequest, error) {
|
||||
|
||||
Reference in New Issue
Block a user