File tree Expand file tree Collapse file tree
api/v3/handlers/subscriptions/subscriptionaddons
openmeter/subscription/addon Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package subscriptionaddons
22
33import (
44 "context"
5+ "errors"
56 "net/http"
67
78 apiv3 "github.com/openmeterio/openmeter/api/v3"
@@ -43,6 +44,10 @@ func (h *handler) GetSubscriptionAddon() GetSubscriptionAddonHandler {
4344 return GetSubscriptionAddonResponse {}, err
4445 }
4546
47+ if a == nil {
48+ return GetSubscriptionAddonResponse {}, models .NewGenericNotFoundError (errors .New ("subscription addon not found" ))
49+ }
50+
4651 return toAPISubscriptionAddon (* a )
4752 },
4853 commonhttp.JSONResponseEncoderWithStatus [GetSubscriptionAddonResponse ](http .StatusOK ),
Original file line number Diff line number Diff line change @@ -85,13 +85,13 @@ type GetSubscriptionAddonInput struct {
8585func (i GetSubscriptionAddonInput ) Validate () error {
8686 var errs []error
8787
88- if err := i .NamespacedID .Validate (); err != nil {
89- errs = append (errs , err )
88+ if i .NamespacedID .Namespace == "" {
89+ errs = append (errs , errors . New ( "namespace is required" ) )
9090 }
9191
9292 if i .ID == "" {
9393 if i .SubscriptionID == "" {
94- errs = append (errs , errors .New ("subscription id or key must be provided if assignment id is not provided" ))
94+ errs = append (errs , errors .New ("subscription id must be provided if assignment id is not provided" ))
9595 } else if _ , err := ulid .Parse (i .SubscriptionID ); err != nil {
9696 errs = append (errs , errors .New ("subscription id is not a valid ULID" ))
9797 }
You can’t perform that action at this time.
0 commit comments