Skip to content

Commit

Permalink
[FAB-5365] Fix bad error in peer CLI Deliver
Browse files Browse the repository at this point in the history
The peer CLI currently attempts to print the error status returned by
the orderer's Deliver gRPC method.  However, the log statement
inappropriately uses the '%T' modifier, and prints the type of the
status, not the actual status code inside it.  Consequently, all deliver
errors read the same uninformative error message:

    Got Status:*orderer.DeliverResponse_Status

This CR fixes this log statement to include the status code instead, and
additionally enhances the other error messages with pertitent
information.

Change-Id: I5a3e1dec574bfab178550cf67bc96a66f1896d5b
Signed-off-by: Jason Yellick <jyellick@us.ibm.com>
  • Loading branch information
Jason Yellick committed Jul 18, 2017
1 parent 85ee523 commit 22e1299
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions peer/channel/deliverclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,14 @@ func (r *deliverClient) readBlock() (*common.Block, error) {

switch t := msg.Type.(type) {
case *ab.DeliverResponse_Status:
logger.Debugf("Got status:%T ", t)
return nil, fmt.Errorf("can't read the block")
logger.Debugf("Got status: %v", t)
return nil, fmt.Errorf("can't read the block: %v", t)
case *ab.DeliverResponse_Block:
logger.Debugf("Received block:%v ", t.Block.Header.Number)
logger.Debugf("Received block: %v", t.Block.Header.Number)
r.client.Recv() // Flush the success message
return t.Block, nil
default:
return nil, fmt.Errorf("response error")
return nil, fmt.Errorf("response error: unknown type %T", t)
}
}

Expand Down

0 comments on commit 22e1299

Please sign in to comment.