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 @@ -49,13 +49,13 @@ type GetSubscriptionAddonInput struct {
4949func (i GetSubscriptionAddonInput ) Validate () error {
5050 var errs []error
5151
52- if err := i .NamespacedID .Validate (); err != nil {
53- errs = append (errs , err )
52+ if i .NamespacedID .Namespace == "" {
53+ errs = append (errs , errors . New ( "namespace is required" ) )
5454 }
5555
5656 if i .ID == "" {
5757 if i .SubscriptionID == "" {
58- errs = append (errs , errors .New ("subscription id or key must be provided if assignment id is not provided" ))
58+ errs = append (errs , errors .New ("subscription id must be provided if assignment id is not provided" ))
5959 } else if _ , err := ulid .Parse (i .SubscriptionID ); err != nil {
6060 errs = append (errs , errors .New ("subscription id is not a valid ULID" ))
6161 }
You can’t perform that action at this time.
0 commit comments