argo-cd/util/errors/credentials.go

21 lines
610 B
Go
Raw Normal View History

fix: Declarative helm repositories with missing secret causes all repositories in ArgoCD to lock (#3492) (#5363) * Add test for get repository credentials Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Log error on missing repository credentials Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Fix import formatting Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Use connection state instead of logging Just logging the error will be a bad user experience, since it provides no direct feedback as before. Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Fix test to check for connection state Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Do not expose technical message directly Instead of displaying a technical error message that might expose critical information about the cluster, we only display a generic error message. The actual error is then logged to the server logged, so that an administrator can further drill down into the problem Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Adapt tests to new error message Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Retrigger CI pipeline Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * See if I am actually the cause of this error Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Revert changes to evaluate CodeQL result Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Desperate attempt to find the cause of the CodeQL error Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Revert "Desperate attempt to find the cause of the CodeQL error" This reverts commit a38ff650 Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Fix first to review findings Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Propose a better function name and add docu Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Overwrite connection status for refresh as well Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com> * Fix goimports lint issue Signed-off-by: Jan Graefen <223234+jangraefen@users.noreply.github.com>
2021-02-16 06:38:06 +00:00
package errors
type credentialsConfigurationError struct {
causingError error
}
func (err *credentialsConfigurationError) Error() string {
return err.causingError.Error()
}
// NewCredentialsConfigurationError wraps any error into a credentials configuration error.
func NewCredentialsConfigurationError(err error) error {
return &credentialsConfigurationError{causingError: err}
}
// IsCredentialsConfigurationError checks if the given error is a wrapped credentials configuration error.
func IsCredentialsConfigurationError(err error) bool {
_, ok := err.(*credentialsConfigurationError)
return ok
}