Skip to content

Commit 22cda1c

Browse files
authored
Merge pull request weaveworks#292 from weaveworks/grpc-is-canceled
grpc: use errors.Is to check if error is Canceled
2 parents e2613be + 4b2e1b7 commit 22cda1c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

grpc/cancel.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@ package grpc
22

33
import (
44
"context"
5+
"errors"
56

67
"google.golang.org/grpc/codes"
78
"google.golang.org/grpc/status"
89
)
910

1011
// IsCanceled checks whether an error comes from an operation being canceled
1112
func IsCanceled(err error) bool {
12-
if err == context.Canceled {
13+
if errors.Is(err, context.Canceled) {
1314
return true
1415
}
1516
s, ok := status.FromError(err)

0 commit comments

Comments
 (0)