@@ -14,7 +14,7 @@ import (
1414
1515 "knative.dev/backstage-plugins/backends/pkg/util"
1616
17- "k8s.io/apimachinery/pkg/api/errors"
17+ apierrors "k8s.io/apimachinery/pkg/api/errors"
1818 "k8s.io/apimachinery/pkg/api/meta"
1919 metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2020 "k8s.io/apimachinery/pkg/labels"
@@ -145,11 +145,16 @@ func BuildEventMesh(ctx context.Context, clientset versioned.Interface, dynamicC
145145
146146 for _ , subscription := range subscriptions .Items {
147147 err := processSubscription (ctx , & subscription , subscribableMap , etByNamespacedName , dynamicClient , logger )
148- if err != nil {
148+ if apierrors . IsForbidden ( err ) {
149149 logger .Errorw ("Error processing subscription" , "error" , err )
150150 // do not stop the Backstage plugin from rendering the rest of the data, e.g. because
151151 // there are no permissions to get a single subscriber resource
152152 }
153+
154+ if err != nil {
155+ logger .Errorw ("Error processing subscription" , "error" , err )
156+ return EventMesh {}, fmt .Errorf ("error processing subscription: %w" , err )
157+ }
153158 }
154159
155160 outputEventTypes := make ([]EventType , 0 , len (convertedEventTypes ))
@@ -337,7 +342,7 @@ func fetchSubscribables(ctx context.Context, dynamicClient dynamic.Interface, lo
337342 },
338343 ).List (ctx , metav1.ListOptions {LabelSelector : labels.Set {"messaging.knative.dev/subscribable" : "true" }.String ()})
339344
340- if errors .IsNotFound (err ) {
345+ if apierrors .IsNotFound (err ) {
341346 return nil , nil
342347 }
343348
@@ -357,7 +362,7 @@ func fetchSubscribables(ctx context.Context, dynamicClient dynamic.Interface, lo
357362
358363 subscribableResources , err := dynamicClient .Resource (gvr ).Namespace (metav1 .NamespaceAll ).List (ctx , metav1.ListOptions {})
359364
360- if errors .IsNotFound (err ) {
365+ if apierrors .IsNotFound (err ) {
361366 continue
362367 }
363368
@@ -385,7 +390,7 @@ func fetchSources(ctx context.Context, dynamicClient dynamic.Interface, logger *
385390 },
386391 ).List (ctx , metav1.ListOptions {LabelSelector : labels.Set {"duck.knative.dev/source" : "true" }.String ()})
387392
388- if errors .IsNotFound (err ) {
393+ if apierrors .IsNotFound (err ) {
389394 return nil , nil
390395 }
391396
@@ -405,7 +410,7 @@ func fetchSources(ctx context.Context, dynamicClient dynamic.Interface, logger *
405410
406411 sourceResources , err := dynamicClient .Resource (gvr ).Namespace (metav1 .NamespaceAll ).List (ctx , metav1.ListOptions {})
407412
408- if errors .IsNotFound (err ) {
413+ if apierrors .IsNotFound (err ) {
409414 continue
410415 }
411416
@@ -457,7 +462,7 @@ func getSubscriberBackstageId(ctx context.Context, client dynamic.Interface, sub
457462 refGvr , _ := meta .UnsafeGuessKindToResource (schema .FromAPIVersionAndKind (subRef .APIVersion , subRef .Kind ))
458463
459464 resource , err := client .Resource (refGvr ).Namespace (subRef .Namespace ).Get (ctx , subRef .Name , metav1.GetOptions {})
460- if errors .IsNotFound (err ) {
465+ if apierrors .IsNotFound (err ) {
461466 logger .Debugw ("Subscriber resource not found" , "resource" , subRef .Name )
462467 return "" , nil
463468 }
0 commit comments