Skip to content

Commit dd5b5ab

Browse files
committed
fix(pc): use correct error
1 parent 829b102 commit dd5b5ab

File tree

2 files changed

+3
-4
lines changed

2 files changed

+3
-4
lines changed

e2e/productcatalog_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,14 +360,15 @@ func TestPlan(t *testing.T) {
360360
misalignedCreate.Alignment = &api.Alignment{
361361
BillablesMustAlign: lo.ToPtr(true),
362362
}
363+
misalignedCreate.BillingCadence = "P1M"
363364

364365
misalignedCreate.Phases = slices.Clone(planCreate.Phases)
365366
misalignedCreate.Phases[0].RateCards = slices.Clone(planCreate.Phases[0].RateCards)
366367
misalignedCreate.Phases[0].RateCards = []api.RateCard{maP1RC1, maP1RC2}
367368

368369
planAPIRes, err := client.CreatePlanWithResponse(ctx, misalignedCreate)
369370
require.Nil(t, err)
370-
require.Equal(t, 201, planAPIRes.StatusCode())
371+
require.Equal(t, 201, planAPIRes.StatusCode(), "received the following body: %s", planAPIRes.Body)
371372

372373
plan := planAPIRes.JSON201
373374
require.NotNil(t, plan, "received the following body: %s", planAPIRes.Body)

openmeter/productcatalog/alignment.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package productcatalog
22

33
import (
4-
"fmt"
5-
64
"github.com/openmeterio/openmeter/pkg/isodate"
75
)
86

@@ -43,5 +41,5 @@ func ValidateBillingCadencesAlign(planBillingCadence isodate.Period, rateCardBil
4341
return nil
4442
}
4543

46-
return fmt.Errorf("billing cadences do not align: %s and %s", planBillingCadence, rateCardBillingCadence)
44+
return ErrRateCardBillingCadenceUnaligned
4745
}

0 commit comments

Comments
 (0)