SEBA-678 Add model delete command
Change-Id: I3f1cbf516b481059937a33d113032def1da2c48d
diff --git a/commands/common.go b/commands/common.go
index 93c1b5d..9810300 100644
--- a/commands/common.go
+++ b/commands/common.go
@@ -24,6 +24,7 @@
"golang.org/x/net/context"
"google.golang.org/grpc"
reflectpb "google.golang.org/grpc/reflection/grpc_reflection_v1alpha"
+ "google.golang.org/grpc/status"
"log"
"os"
"strings"
@@ -93,3 +94,16 @@
}
}
}
+
+func HumanReadableError(err error) string {
+ st, ok := status.FromError(err)
+ if ok {
+ grpc_message := st.Message()
+ if strings.HasPrefix(grpc_message, "Exception calling application: ") {
+ return st.Message()[31:]
+ } else {
+ return st.Message()
+ }
+ }
+ return err.Error()
+}