From 22e1299566b9fabcea48d5c69ee3d1aa20530c07 Mon Sep 17 00:00:00 2001 From: Jason Yellick Date: Tue, 18 Jul 2017 12:52:15 -0400 Subject: [PATCH] [FAB-5365] Fix bad error in peer CLI Deliver 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 --- peer/channel/deliverclient.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/peer/channel/deliverclient.go b/peer/channel/deliverclient.go index 6f467965d36..550815ed8fc 100644 --- a/peer/channel/deliverclient.go +++ b/peer/channel/deliverclient.go @@ -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) } }