Skip to content

Commit

Permalink
Bitfinex: Use err vars for chanForSub
Browse files Browse the repository at this point in the history
  • Loading branch information
gbjk committed Sep 13, 2023
1 parent 8f0a583 commit 068dfea
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions exchanges/bitfinex/bitfinex_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import (
)

var (
errTypeAssert = errors.New("type assertion failed")
errSetCannotBeEmpty = errors.New("set cannot be empty")
errSetCannotBeEmpty = errors.New("set cannot be empty")
errSubNotFound = errors.New("could not find matching subscription")
errTooManyMatchingSubs = errors.New("too many matching subscriptions")
errTypeAssert = errors.New("type assertion failed")
)

// AccountV2Data stores account v2 data
Expand Down
4 changes: 2 additions & 2 deletions exchanges/bitfinex/bitfinex_websocket.go
Original file line number Diff line number Diff line change
Expand Up @@ -1559,13 +1559,13 @@ func (b *Bitfinex) chanForSub(cName string, assetType asset.Item, pair currency.
for i := range subs {
if subs[i].Equal(want) {
if c != nil {
return nil, errors.New("too many matching subscriptions to find params")
return nil, errTooManyMatchingSubs
}
c = &subs[i]
}
}
if c == nil {
return nil, errors.New("could not find matching subscription")
return nil, errSubNotFound
}

return c, nil
Expand Down

0 comments on commit 068dfea

Please sign in to comment.