Skip to content

Commit

Permalink
Minor fix fmt.errorf to errors.new
Browse files Browse the repository at this point in the history
Change-Id: I39c60d7834bc6a87e7d0601fcd4a607a4b3f85b2
Signed-off-by: grapebaba <281165273@qq.com>
  • Loading branch information
GrapeBaBa committed Oct 19, 2016
1 parent 4b53c7c commit fe5f2cd
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions core/devops.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ func (d *Devops) Deploy(ctx context.Context, spec *pb.ChaincodeSpec) (*pb.Chainc
}
resp := d.coord.ExecuteTransaction(tx)
if resp.Status == pb.Response_FAILURE {
err = fmt.Errorf(string(resp.Msg))
err = errors.New(string(resp.Msg))
}

return chaincodeDeploymentSpec, err
Expand All @@ -205,7 +205,7 @@ func (d *Devops) Deploy(ctx context.Context, spec *pb.ChaincodeSpec) (*pb.Chainc
func (d *Devops) invokeOrQuery(ctx context.Context, chaincodeInvocationSpec *pb.ChaincodeInvocationSpec, attributes []string, invoke bool) (*pb.Response, error) {

if chaincodeInvocationSpec.ChaincodeSpec.ChaincodeID.Name == "" {
return nil, fmt.Errorf("name not given for invoke/query")
return nil, errors.New("name not given for invoke/query")
}

// Now create the Transactions message and send to Peer.
Expand Down Expand Up @@ -249,12 +249,10 @@ func (d *Devops) invokeOrQuery(ctx context.Context, chaincodeInvocationSpec *pb.
if err != nil {
return nil, err
}
if devopsLogger.IsEnabledFor(logging.DEBUG) {
devopsLogger.Debugf("Sending invocation transaction (%s) to validator", transaction.Txid)
}
devopsLogger.Debugf("Sending invocation transaction (%s) to validator", transaction.Txid)
resp := d.coord.ExecuteTransaction(transaction)
if resp.Status == pb.Response_FAILURE {
err = fmt.Errorf(string(resp.Msg))
err = errors.New(string(resp.Msg))
} else {
if !invoke && nil != sec && viper.GetBool("security.privacy") {
if resp.Msg, err = sec.DecryptQueryResult(transaction, resp.Msg); nil != err {
Expand Down

0 comments on commit fe5f2cd

Please sign in to comment.