mirror of
https://github.com/juanfont/headscale.git
synced 2026-03-19 04:33:36 +09:00
Unwrap grpc errors to make nicer user facing errors
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user