From 4135ec7d30f3827626ea06f183168af3508c69fe Mon Sep 17 00:00:00 2001 From: Denis Subbotin Date: Sat, 24 Feb 2024 12:31:20 +0300 Subject: [PATCH] check errors in scan request --- rawkv/rawkv.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/rawkv/rawkv.go b/rawkv/rawkv.go index 00412987f..83c937031 100644 --- a/rawkv/rawkv.go +++ b/rawkv/rawkv.go @@ -539,6 +539,9 @@ func (c *Client) Scan(ctx context.Context, startKey, endKey []byte, limit int, o } cmdResp := resp.Resp.(*kvrpcpb.RawScanResponse) for _, pair := range cmdResp.Kvs { + if pair.Error != nil { + return nil, nil, errors.New(pair.Error.String()) + } keys = append(keys, pair.Key) values = append(values, convertNilToEmptySlice(pair.Value)) } @@ -588,6 +591,9 @@ func (c *Client) ReverseScan(ctx context.Context, startKey, endKey []byte, limit } cmdResp := resp.Resp.(*kvrpcpb.RawScanResponse) for _, pair := range cmdResp.Kvs { + if pair.Error != nil { + return nil, nil, errors.New(pair.Error.String()) + } keys = append(keys, pair.Key) values = append(values, convertNilToEmptySlice(pair.Value)) }