improve blocksync errors

This commit is contained in:
whyrusleeping 2019-08-02 15:32:02 -07:00
parent 14f6cc8a0b
commit 6dfecf523b

View File

@ -108,6 +108,7 @@ func (bss *BlockSyncService) processRequest(req *BlockSyncRequest) (*BlockSyncRe
if len(req.Start) == 0 { if len(req.Start) == 0 {
return &BlockSyncResponse{ return &BlockSyncResponse{
Status: 204, Status: 204,
Message: "no cids given in blocksync request",
}, nil }, nil
} }
@ -288,7 +289,9 @@ func (bs *BlockSync) GetFullTipSet(ctx context.Context, p peer.ID, h []cid.Cid)
case 202: // Go Away case 202: // Go Away
panic("not handled") panic("not handled")
case 203: // Internal Error case 203: // Internal Error
return nil, fmt.Errorf("block sync peer errored: %s", res.Message) return nil, fmt.Errorf("block sync peer errored: %q", res.Message)
case 204: // Invalid Request
return nil, fmt.Errorf("block sync request invalid: %q", res.Message)
default: default:
return nil, fmt.Errorf("unrecognized response code") return nil, fmt.Errorf("unrecognized response code")
} }