[VOL-4442] grpc streaming connection monitoring
Change-Id: Id787e94cf28745d36e72f8ed2f5c316312714db4
diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go
index af2cffe..6d163b6 100644
--- a/vendor/google.golang.org/grpc/status/status.go
+++ b/vendor/google.golang.org/grpc/status/status.go
@@ -29,6 +29,7 @@
import (
"context"
+ "errors"
"fmt"
spb "google.golang.org/genproto/googleapis/rpc/status"
@@ -117,18 +118,18 @@
return codes.Unknown
}
-// FromContextError converts a context error into a Status. It returns a
-// Status with codes.OK if err is nil, or a Status with codes.Unknown if err is
-// non-nil and not a context error.
+// FromContextError converts a context error or wrapped context error into a
+// Status. It returns a Status with codes.OK if err is nil, or a Status with
+// codes.Unknown if err is non-nil and not a context error.
func FromContextError(err error) *Status {
- switch err {
- case nil:
+ if err == nil {
return nil
- case context.DeadlineExceeded:
- return New(codes.DeadlineExceeded, err.Error())
- case context.Canceled:
- return New(codes.Canceled, err.Error())
- default:
- return New(codes.Unknown, err.Error())
}
+ if errors.Is(err, context.DeadlineExceeded) {
+ return New(codes.DeadlineExceeded, err.Error())
+ }
+ if errors.Is(err, context.Canceled) {
+ return New(codes.Canceled, err.Error())
+ }
+ return New(codes.Unknown, err.Error())
}