瀏覽代碼

better error messages

Co-authored-by: Mariano Cano <mariano.cano@gmail.com>
Erik DeLamarter 4 年之前
父節點
當前提交
07984a968f
共有 1 個文件被更改,包括 3 次插入 和 3 次删除
  1. 3 3
      cas/vaultcas/vaultcas.go

+ 3 - 3
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")