diff options
author | Daniel J Walsh <dwalsh@redhat.com> | 2022-02-17 13:46:51 -0500 |
---|---|---|
committer | Daniel J Walsh <dwalsh@redhat.com> | 2022-02-22 14:38:57 -0500 |
commit | 80c5962dba7f5ecd6b602aecd0df479bd04391b1 (patch) | |
tree | a1d7fada738182c2eb8cd6993f33625ae704ba94 /vendor/google.golang.org/grpc/status | |
parent | d3903a85910979d8212028cf814574047015db58 (diff) | |
download | podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.gz podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.tar.bz2 podman-80c5962dba7f5ecd6b602aecd0df479bd04391b1.zip |
Add containers-common spec and command to podman
Since containers-common package is tied to specific versions
of Podman, add tools to build the package into the contrib directory
This should help other distributions to figure out which commont
package to ship.
Signed-off-by: Daniel J Walsh <dwalsh@redhat.com>
Diffstat (limited to 'vendor/google.golang.org/grpc/status')
-rw-r--r-- | vendor/google.golang.org/grpc/status/status.go | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/vendor/google.golang.org/grpc/status/status.go b/vendor/google.golang.org/grpc/status/status.go index af2cffe98..6d163b6e3 100644 --- a/vendor/google.golang.org/grpc/status/status.go +++ b/vendor/google.golang.org/grpc/status/status.go @@ -29,6 +29,7 @@ package status import ( "context" + "errors" "fmt" spb "google.golang.org/genproto/googleapis/rpc/status" @@ -117,18 +118,18 @@ func Code(err error) codes.Code { 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: + } + if errors.Is(err, context.DeadlineExceeded) { return New(codes.DeadlineExceeded, err.Error()) - case context.Canceled: + } + if errors.Is(err, context.Canceled) { return New(codes.Canceled, err.Error()) - default: - return New(codes.Unknown, err.Error()) } + return New(codes.Unknown, err.Error()) } |