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:
committed by
Soam Vasani
parent
eae5150bff
commit
ab6e2e8021
@@ -26,8 +26,6 @@ import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
log "github.com/Sirupsen/logrus"
|
||||
|
||||
"github.com/fission/fission"
|
||||
)
|
||||
|
||||
@@ -104,10 +102,6 @@ func (c *Client) FunctionCreate(f *fission.Function) (*fission.Metadata, error)
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"name": f.Metadata.Name,
|
||||
"err": err,
|
||||
}).Error("Failed to create function")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -240,10 +234,6 @@ func (c *Client) HTTPTriggerCreate(t *fission.HTTPTrigger) (*fission.Metadata, e
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"name": t.Metadata.Name,
|
||||
"err": err,
|
||||
}).Error("Failed to create http trigger")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -351,10 +341,6 @@ func (c *Client) EnvironmentCreate(env *fission.Environment) (*fission.Metadata,
|
||||
|
||||
body, err := c.handleResponse(resp)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{
|
||||
"name": env.Metadata.Name,
|
||||
"err": err,
|
||||
}).Error("Failed to create environment")
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user