Skip to content

Commit

Permalink
New error code for Secret not found (#33)
Browse files Browse the repository at this point in the history
Updated from `ackerr.NotFound` to `SecretNotFound`
  • Loading branch information
nmvk authored Jul 21, 2021
1 parent 8da9852 commit cdc2824
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions pkg/errors/error.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ var (
// SecretTypeNotSupported is returned if non opaque secret is used.
SecretTypeNotSupported = fmt.Errorf(
"only opaque secrets can be used")
// SecretNotFound is returned if specified kubernetes secret is not found.
SecretNotFound = fmt.Errorf(
"kubernetes secret not found")
)

// AWSError returns the type conversion for the supplied error to an aws-sdk-go
Expand Down
4 changes: 2 additions & 2 deletions pkg/runtime/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ func (r *reconciler) SecretValueFromReference(
}
var secret corev1.Secret
if err := r.kc.Get(ctx, nsn, &secret); err != nil {
return "", err
return "", ackerr.SecretNotFound
}

// Currently we have only Opaque secrets in scope.
Expand All @@ -118,7 +118,7 @@ func (r *reconciler) SecretValueFromReference(
return valuestr, nil
}

return "", ackerr.NotFound
return "", ackerr.SecretNotFound
}

// Reconcile implements `controller-runtime.Reconciler` and handles reconciling
Expand Down

0 comments on commit cdc2824

Please sign in to comment.