Skip to content
This repository has been archived by the owner on Jul 11, 2023. It is now read-only.

cli: encode error along with message for additional context #1905

Merged
merged 1 commit into from
Oct 23, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/cli/install.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,12 +121,12 @@ func newInstallCmd(config *helm.Configuration, out io.Writer) *cobra.Command {
RunE: func(_ *cobra.Command, args []string) error {
kubeconfig, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(kubeconfig)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig, %s", err)
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
inst.clientSet = clientset
return inst.run(config)
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/mesh_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ func newMeshList(out io.Writer) *cobra.Command {
RunE: func(_ *cobra.Command, args []string) error {
config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}
clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
meshList.clientSet = clientset
return meshList.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/metrics_disable.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ func newMetricsDisable(out io.Writer) *cobra.Command {
RunE: func(_ *cobra.Command, args []string) error {
config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
disableCmd.clientSet = clientset
return disableCmd.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/metrics_enable.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@ func newMetricsEnable(out io.Writer) *cobra.Command {
RunE: func(_ *cobra.Command, args []string) error {
config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
enableCmd.clientSet = clientset
return enableCmd.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/namespace_add.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,12 @@ func newNamespaceAdd(out io.Writer) *cobra.Command {
namespaceAdd.namespaces = args
config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
namespaceAdd.clientSet = clientset
return namespaceAdd.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/namespace_ignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,12 @@ func newNamespaceIgnore(out io.Writer) *cobra.Command {
ignoreCmd.namespaces = args
config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
ignoreCmd.clientSet = clientset
return ignoreCmd.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/namespace_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@ func newNamespaceList(out io.Writer) *cobra.Command {

config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
namespaceList.clientSet = clientset
return namespaceList.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/namespace_remove.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@ func newNamespaceRemove(out io.Writer) *cobra.Command {
namespaceRemove.namespace = args[0]
config, err := settings.RESTClientGetter().ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}

clientset, err := kubernetes.NewForConfig(config)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
namespaceRemove.clientSet = clientset
return namespaceRemove.run()
Expand Down
4 changes: 2 additions & 2 deletions cmd/cli/proxy_configdump.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,13 @@ func newProxyDumpConfig(config *action.Configuration, out io.Writer) *cobra.Comm
dumpConfigCmd.pod = args[0]
conf, err := config.RESTClientGetter.ToRESTConfig()
if err != nil {
return errors.Errorf("Error fetching kubeconfig")
return errors.Errorf("Error fetching kubeconfig: %s", err)
}
dumpConfigCmd.config = conf

clientset, err := kubernetes.NewForConfig(conf)
if err != nil {
return errors.Errorf("Could not access Kubernetes cluster. Check kubeconfig")
return errors.Errorf("Could not access Kubernetes cluster, check kubeconfig: %s", err)
}
dumpConfigCmd.clientSet = clientset
return dumpConfigCmd.run()
Expand Down