Unwrap grpc errors to make nicer user facing errors
This commit is contained in:
parent
b11acad1c9
commit
d47b83f80b
4 changed files with 18 additions and 14 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
v1 "github.com/juanfont/headscale/gen/go/headscale/v1"
|
||||
"github.com/rs/zerolog/log"
|
||||
"github.com/spf13/cobra"
|
||||
"google.golang.org/grpc/status"
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -80,7 +81,7 @@ var createNodeCmd = &cobra.Command{
|
|||
|
||||
response, err := client.DebugCreateMachine(ctx, request)
|
||||
if err != nil {
|
||||
ErrorOutput(err, fmt.Sprintf("Cannot create machine: %s", err), output)
|
||||
ErrorOutput(err, fmt.Sprintf("Cannot create machine: %s", status.Convert(err).Message()), output)
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue