mirror of
https://github.com/juanfont/headscale.git
synced 2026-11-04 20:49:24 +09:00
Unwrap grpc errors to make nicer user facing errors
This commit is contained in:
1 parent
b11acad1c9
commit
d47b83f80b
4 files changed
+18
-14
No files matched your search
@@ -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