Skip to content

Commit 7567735

Browse files
committed
Error checks
1 parent 5cf87e6 commit 7567735

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

cmd/non-admin/backup/create.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
259259
ObjectList: new(nacv1alpha1.NonAdminBackupList),
260260
}
261261
backupInformer := cache.NewSharedInformer(&lw, &nacv1alpha1.NonAdminBackup{}, time.Second)
262-
_, _ = backupInformer.AddEventHandler(
262+
_, err = backupInformer.AddEventHandler(
263263
cache.FilteringResourceEventHandler{
264264
FilterFunc: func(obj any) bool {
265265
backup, ok := obj.(*nacv1alpha1.NonAdminBackup)
@@ -287,6 +287,9 @@ func (o *CreateOptions) Run(c *cobra.Command, f client.Factory) error {
287287
},
288288
},
289289
)
290+
if err != nil {
291+
return fmt.Errorf("failed to add event handler: %w", err)
292+
}
290293

291294
go backupInformer.Run(stop)
292295
}

0 commit comments

Comments
 (0)