diff --git a/internal/retry.go b/internal/retry.go index 290e744b7d36..4c9220e0dc36 100644 --- a/internal/retry.go +++ b/internal/retry.go @@ -20,8 +20,6 @@ import ( "time" gax "github.com/googleapis/gax-go/v2" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" ) // Retry calls the supplied function f repeatedly according to the provided @@ -76,11 +74,3 @@ func (e wrappedCallErr) Unwrap() error { func (e wrappedCallErr) Is(err error) bool { return e.ctxErr == err || e.wrappedErr == err } - -// GRPCStatus allows the wrapped error to be used with status.FromError. -func (e wrappedCallErr) GRPCStatus() *status.Status { - if s, ok := status.FromError(e.wrappedErr); ok { - return s - } - return status.New(codes.Unknown, e.Error()) -} diff --git a/internal/retry_test.go b/internal/retry_test.go index 1c26dcbcc394..0ede8b747ceb 100644 --- a/internal/retry_test.go +++ b/internal/retry_test.go @@ -88,7 +88,7 @@ func TestRetryPreserveError(t *testing.T) { if g, w := got.Code(), codes.NotFound; g != w { t.Errorf("got code %v, want %v", g, w) } - wantMessage := "not found" + wantMessage := "retry failed with context deadline exceeded; last error: rpc error: code = NotFound desc = not found" if g, w := got.Message(), wantMessage; g != w { t.Errorf("got message %q, want %q", g, w) } @@ -111,10 +111,7 @@ func TestRetryWrapsErrorWithStatusUnknown(t *testing.T) { if g, w := err.Error(), wantError; g != w { t.Errorf("got error %q, want %q", g, w) } - got, ok := status.FromError(err) - if !ok { - t.Fatal("expected error to implement a gRPC status") - } + got, _ := status.FromError(err) if g, w := got.Code(), codes.Unknown; g != w { t.Errorf("got code %v, want %v", g, w) }