Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
helm3
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
helm3
Commits
bf77961c
Unverified
Commit
bf77961c
authored
Feb 27, 2018
by
Matthew Fisher
Committed by
GitHub
Feb 27, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3383 from PureWhiteWu/refactor/error
refactor prettyError, closes #3381
parents
fbe04e73
0ddfbaaf
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
helm.go
cmd/helm/helm.go
+8
-6
No files found.
cmd/helm/helm.go
View file @
bf77961c
...
@@ -17,7 +17,6 @@ limitations under the License.
...
@@ -17,7 +17,6 @@ limitations under the License.
package
main
// import "k8s.io/helm/cmd/helm"
package
main
// import "k8s.io/helm/cmd/helm"
import
(
import
(
"errors"
"fmt"
"fmt"
"io/ioutil"
"io/ioutil"
"log"
"log"
...
@@ -25,8 +24,8 @@ import (
...
@@ -25,8 +24,8 @@ import (
"strings"
"strings"
"github.com/spf13/cobra"
"github.com/spf13/cobra"
"google.golang.org/grpc"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/grpclog"
"google.golang.org/grpc/status"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/kubernetes"
"k8s.io/client-go/rest"
"k8s.io/client-go/rest"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
"k8s.io/kubernetes/pkg/client/clientset_generated/internalclientset"
...
@@ -209,13 +208,16 @@ func checkArgsLength(argsReceived int, requiredArgs ...string) error {
...
@@ -209,13 +208,16 @@ func checkArgsLength(argsReceived int, requiredArgs ...string) error {
// prettyError unwraps or rewrites certain errors to make them more user-friendly.
// prettyError unwraps or rewrites certain errors to make them more user-friendly.
func
prettyError
(
err
error
)
error
{
func
prettyError
(
err
error
)
error
{
// Add this check can prevent the object creation if err is nil.
if
err
==
nil
{
if
err
==
nil
{
return
nil
return
nil
}
}
// This is ridiculous. Why is 'grpc.rpcError' not exported? The least they
// If it's grpc's error, make it more user-friendly.
// could do is throw an interface on the lib that would let us get back
if
s
,
ok
:=
status
.
FromError
(
err
);
ok
{
// the desc. Instead, we have to pass ALL errors through this.
return
s
.
Err
()
return
errors
.
New
(
grpc
.
ErrorDesc
(
err
))
}
// Else return the original error.
return
err
}
}
// configForContext creates a Kubernetes REST client configuration for a given kubeconfig context.
// configForContext creates a Kubernetes REST client configuration for a given kubeconfig context.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment