Skip to content

Commit

Permalink
Merge pull request #342 from 14rcole/remove-logger-method
Browse files Browse the repository at this point in the history
hotfix: remove HandleLoaderError from logger struct
  • Loading branch information
14rcole authored Oct 3, 2023
2 parents ea78aba + 3d82d36 commit 8f74023
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion controllers/snapshot/snapshot_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Resu
return err
})
if err != nil {
return logger.HandleLoaderError(err, "Component", "Snapshot")
return helpers.HandleLoaderError(logger, err, "Component", "Snapshot")
}

adapter := NewAdapter(snapshot, application, component, logger, loader, r.Client, ctx)
Expand Down
8 changes: 4 additions & 4 deletions helpers/errorhandlers.go
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
Copyright 2023.
Copyright 2023 Red Hat Inc.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand All @@ -20,11 +20,11 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
)

func (l IntegrationLogger) HandleLoaderError(err error, resource, from string) (ctrl.Result, error) {
func HandleLoaderError(logger IntegrationLogger, err error, resource, from string) (ctrl.Result, error) {
if errors.IsNotFound(err) {
l.Info(fmt.Sprintf("Could not get %[1]s from %[2]s. %[1]s may have been removed. Declining to proceed with reconciliation", resource, from))
logger.Info(fmt.Sprintf("Could not get %[1]s from %[2]s. %[1]s may have been removed. Declining to proceed with reconciliation", resource, from))
return ctrl.Result{}, nil
}
l.Error(err, fmt.Sprintf("Failed to get %s from the %s", resource, from))
logger.Error(err, fmt.Sprintf("Failed to get %s from the %s", resource, from))
return ctrl.Result{}, err
}

0 comments on commit 8f74023

Please sign in to comment.