Skip to content

Commit 22e1299

Browse files
author
Jason Yellick
committed
[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 <[email protected]>
1 parent 85ee523 commit 22e1299

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

peer/channel/deliverclient.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,14 +82,14 @@ func (r *deliverClient) readBlock() (*common.Block, error) {
8282

8383
switch t := msg.Type.(type) {
8484
case *ab.DeliverResponse_Status:
85-
logger.Debugf("Got status:%T ", t)
86-
return nil, fmt.Errorf("can't read the block")
85+
logger.Debugf("Got status: %v", t)
86+
return nil, fmt.Errorf("can't read the block: %v", t)
8787
case *ab.DeliverResponse_Block:
88-
logger.Debugf("Received block:%v ", t.Block.Header.Number)
88+
logger.Debugf("Received block: %v", t.Block.Header.Number)
8989
r.client.Recv() // Flush the success message
9090
return t.Block, nil
9191
default:
92-
return nil, fmt.Errorf("response error")
92+
return nil, fmt.Errorf("response error: unknown type %T", t)
9393
}
9494
}
9595

0 commit comments

Comments
 (0)