Skip to content

Commit

Permalink
Minor error handling change
Browse files Browse the repository at this point in the history
  • Loading branch information
samuelattwood committed Dec 31, 2024
1 parent 7c2e18a commit b28544f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions internal/controller/consumer_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@ func (r *ConsumerReconciler) createOrUpdate(ctx context.Context, log klog.Logger
_, err := js.Consumer(ctx, consumer.Spec.StreamName, consumerName)
if err == nil {
exists = true
} else if !errors.Is(err, jetstream.ErrConsumerNotFound) {
return err
}

if !exists {
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/keyvalue_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func (r *KeyValueReconciler) createOrUpdate(ctx context.Context, log logr.Logger
_, err := js.KeyValue(ctx, targetConfig.Bucket)
if err == nil {
exists = true
} else if !errors.Is(err, jetstream.ErrBucketNotFound) {
return err
}

if !exists {
Expand Down
2 changes: 2 additions & 0 deletions internal/controller/stream_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ func (r *StreamReconciler) createOrUpdate(ctx context.Context, log logr.Logger,
_, err := js.Stream(ctx, targetConfig.Name)
if err == nil {
exists = true
} else if !errors.Is(err, jetstream.ErrStreamNotFound) {
return err
}

if !exists {
Expand Down

0 comments on commit b28544f

Please sign in to comment.