VOL-2170 add common method the output GRPC status error
Change-Id: Ibc48cb087cd73f981542bcb137bdb4f213fa7e8d
diff --git a/internal/pkg/commands/devices.go b/internal/pkg/commands/devices.go
index ac6d508..8b603f8 100644
--- a/internal/pkg/commands/devices.go
+++ b/internal/pkg/commands/devices.go
@@ -303,10 +303,10 @@
err = grpcurl.InvokeRPC(ctx, descriptor, conn, method, []string{}, h, h.GetParams)
if err != nil {
- fmt.Printf("Error while deleting '%s': %s\n", i, err)
+ Error.Printf("Error while deleting '%s': %s\n", i, err)
continue
} else if h.Status != nil && h.Status.Err() != nil {
- fmt.Printf("Error while deleting '%s': %s\n", i, h.Status.Err())
+ Error.Printf("Error while deleting '%s': %s\n", i, ErrorToString(h.Status.Err()))
continue
}
fmt.Printf("%s\n", i)
@@ -336,10 +336,10 @@
err = grpcurl.InvokeRPC(ctx, descriptor, conn, method, []string{}, h, h.GetParams)
if err != nil {
- fmt.Printf("Error while enabling '%s': %s\n", i, err)
+ Error.Printf("Error while enabling '%s': %s\n", i, err)
continue
} else if h.Status != nil && h.Status.Err() != nil {
- fmt.Printf("Error while enabling '%s': %s\n", i, h.Status.Err())
+ Error.Printf("Error while enabling '%s': %s\n", i, ErrorToString(h.Status.Err()))
continue
}
fmt.Printf("%s\n", i)
@@ -369,10 +369,10 @@
err = grpcurl.InvokeRPC(ctx, descriptor, conn, method, []string{}, h, h.GetParams)
if err != nil {
- fmt.Printf("Error while disabling '%s': %s\n", i, err)
+ Error.Printf("Error while disabling '%s': %s\n", i, err)
continue
} else if h.Status != nil && h.Status.Err() != nil {
- fmt.Printf("Error while disabling '%s': %s\n", i, h.Status.Err())
+ Error.Printf("Error while disabling '%s': %s\n", i, ErrorToString(h.Status.Err()))
continue
}
fmt.Printf("%s\n", i)
@@ -402,10 +402,10 @@
err = grpcurl.InvokeRPC(ctx, descriptor, conn, method, []string{}, h, h.GetParams)
if err != nil {
- fmt.Printf("Error while rebooting '%s': %s\n", i, err)
+ Error.Printf("Error while rebooting '%s': %s\n", i, err)
continue
} else if h.Status != nil && h.Status.Err() != nil {
- fmt.Printf("Error while rebooting '%s': %s\n", i, h.Status.Err())
+ Error.Printf("Error while rebooting '%s': %s\n", i, ErrorToString(h.Status.Err()))
continue
}
fmt.Printf("%s\n", i)