From 092ee0ba59267b8fb4d3f4e7727ed3ccbf81e7e7 Mon Sep 17 00:00:00 2001 From: Baha Aiman Date: Tue, 23 Jan 2024 16:51:02 -0800 Subject: [PATCH] fix(bigtable): Fix deadline exceeded conformance test (#9220) --- bigtable/bigtable.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/bigtable/bigtable.go b/bigtable/bigtable.go index 0cd7a7084f08..147d8f36e9c5 100644 --- a/bigtable/bigtable.go +++ b/bigtable/bigtable.go @@ -278,6 +278,18 @@ func (t *Table) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts return err }, retryOptions...) + // Convert error to grpc status error + if err != nil { + if errStatus, ok := status.FromError(err); ok { + return status.Error(errStatus.Code(), errStatus.Message()) + } + + ctxStatus := status.FromContextError(err) + if ctxStatus.Code() != codes.Unknown { + return status.Error(ctxStatus.Code(), ctxStatus.Message()) + } + } + return err } @@ -285,6 +297,8 @@ func (t *Table) ReadRows(ctx context.Context, arg RowSet, f func(Row) bool, opts // A missing row will return nil for both Row and error. func (t *Table) ReadRow(ctx context.Context, row string, opts ...ReadOption) (Row, error) { var r Row + + opts = append([]ReadOption{LimitRows(1)}, opts...) err := t.ReadRows(ctx, SingleRow(row), func(rr Row) bool { r = rr return true