Skip to content

Commit

Permalink
fix(bigtable): Fix deadline exceeded conformance test (#9220)
Browse files Browse the repository at this point in the history
  • Loading branch information
bhshkh authored Jan 24, 2024
1 parent 98c9d71 commit 092ee0b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions bigtable/bigtable.go
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,27 @@ 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
}

// ReadRow is a convenience implementation of a single-row reader.
// 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
Expand Down

0 comments on commit 092ee0b

Please sign in to comment.