Improve command-line client error output (#122)

Motivation: The output when an error occurs shows an integer error code,
which isn't very helpful. And in the case of an error when creating a
resource, you also get a redundant log message from the controller
client.

Modifications:
* the controller client no longer logs errors
* the generated String() allows for the enum name to be displayed in the
  error output
* each errorCode enum member has a hand-generated description
* the format of the error message from the CLI client was modified to
  display the error description with the error message

Related to #112
This commit is contained in:
Toby Crawley
2017-02-16 13:58:59 -08:00
committed by Soam Vasani
parent eae5150bff
commit ab6e2e8021
4 changed files with 50 additions and 35 deletions
+12
View File
@@ -72,6 +72,7 @@ type (
Code errorCode `json:"code"`
Message string `json:"message"`
}
errorCode int
)
@@ -85,3 +86,14 @@ const (
ErrorNoSpace
ErrorNotImplmented
)
// must match order and len of the above const
var errorDescriptions = []string{
"Internal error",
"Not authorized",
"Resource not found",
"Resource exists",
"Invalid argument",
"No space",
"Not implemented",
}