From 07984a968fba1eedfa514d80e088a41e1f59651f Mon Sep 17 00:00:00 2001 From: Erik DeLamarter Date: Sat, 21 May 2022 21:00:50 +0200 Subject: [PATCH] better error messages Co-authored-by: Mariano Cano --- cas/vaultcas/vaultcas.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cas/vaultcas/vaultcas.go b/cas/vaultcas/vaultcas.go index 02c814b7..a5658620 100644 --- a/cas/vaultcas/vaultcas.go +++ b/cas/vaultcas/vaultcas.go @@ -84,15 +84,15 @@ func New(ctx context.Context, opts apiv1.Options) (*VaultCAS, error) { case "approle": method, err = approle.NewApproleAuthMethod(vc.AuthMountPath, vc.AuthOptions) default: - return nil, fmt.Errorf("unknown auth type: %v", vc.AuthType) + return nil, fmt.Errorf("unknown auth type: %s, only 'kubernetes' and 'approle' currently supported", vc.AuthType) } if err != nil { - return nil, fmt.Errorf("unable to configure auth method: %w", err) + return nil, fmt.Errorf("unable to configure %s auth method: %w", vc.AuthType, err) } authInfo, err := client.Auth().Login(ctx, method) if err != nil { - return nil, fmt.Errorf("unable to login to Kubernetes auth method: %w", err) + return nil, fmt.Errorf("unable to login to %s auth method: %w", vc.AuthType, err) } if authInfo == nil { return nil, errors.New("no auth info was returned after login")