diff --git a/exchanges/subscription/template.go b/exchanges/subscription/template.go index 8c928c911eb..b629d65307c 100644 --- a/exchanges/subscription/template.go +++ b/exchanges/subscription/template.go @@ -20,13 +20,13 @@ const ( ) var ( - errInvalidAssetExpandPairs = errors.New("subscription template containing PairSeparator with must contain either specific Asset or AssetSeparator") - errAssetRecords = errors.New("subscription template did not generate the expected number of asset records") - errPairRecords = errors.New("subscription template did not generate the expected number of pair records") - errTooManyBatchSize = errors.New("too many BatchSize directives") - errAssetTemplateWithoutAll = errors.New("sub.Asset must be set to All if AssetSeparator is used in Channel template") - errNoTemplateContent = errors.New("subscription template did not generate content") - errInvalidTemplate = errors.New("GetSubscriptionTemplate did not return a template") + errInvalidAssetExpandPairs = errors.New("subscription template containing PairSeparator with must contain either specific Asset or AssetSeparator") + errAssetRecords = errors.New("subscription template did not generate the expected number of asset records") + errPairRecords = errors.New("subscription template did not generate the expected number of pair records") + errTooManyBatchSizePerAsset = errors.New("more than one BatchSize directive inside an AssetSeparator") + errAssetTemplateWithoutAll = errors.New("sub.Asset must be set to All if AssetSeparator is used in Channel template") + errNoTemplateContent = errors.New("subscription template did not generate content") + errInvalidTemplate = errors.New("GetSubscriptionTemplate did not return a template") ) type tplCtx struct { @@ -150,7 +150,7 @@ func expandTemplate(e iExchange, s *Subscription, ap assetPairs, assets asset.It batchSize := len(pairs) // Default to all pairs in one batch if b := strings.Split(assetChannels, subCtx.BatchSize); len(b) > 2 { - return nil, fmt.Errorf("%w for %s", errTooManyBatchSize, a) + return nil, fmt.Errorf("%w for %s", errTooManyBatchSizePerAsset, a) } else if len(b) == 2 { // If there's a batch size indicator we batch by that assetChannels = b[0] if batchSize, err = strconv.Atoi(strings.TrimSpace(b[1])); err != nil { diff --git a/exchanges/subscription/template_test.go b/exchanges/subscription/template_test.go index 7c62b98f821..f14e851ea8f 100644 --- a/exchanges/subscription/template_test.go +++ b/exchanges/subscription/template_test.go @@ -107,7 +107,7 @@ func TestExpandTemplates(t *testing.T) { assert.ErrorIs(t, err, errPairRecords, "Should error correctly when invalid number of pair entries") _, err = List{{Channel: "error4", Asset: asset.Spot}}.ExpandTemplates(e) - assert.ErrorIs(t, err, errTooManyBatchSize, "Should error correctly when too many BatchSize directives") + assert.ErrorIs(t, err, errTooManyBatchSizePerAsset, "Should error correctly when too many BatchSize directives") _, err = List{{Channel: "error5", Asset: asset.Spot}}.ExpandTemplates(e) assert.ErrorIs(t, err, common.ErrTypeAssertFailure, "Should error correctly when batch size isn't an int")