Skip to content

Commit 51aca40

Browse files
committed
solver: use errors.Is when checking context.Cause()
Since the change to replace uses of context.WithCancel with WithCancelCause, we've also begun wrapping all cancellations using errors.WithStack. This means that these would not directly match context.Canceled, so we need to make sure to use errors.Is. Signed-off-by: Justin Chadwell <[email protected]>
1 parent 83fd009 commit 51aca40

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

solver/errdefs/context.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func IsCanceled(ctx context.Context, err error) bool {
1414
return true
1515
}
1616
// grpc does not set cancel correctly when stream gets cancelled and then Recv is called
17-
if err != nil && context.Cause(ctx) == context.Canceled {
17+
if err != nil && errors.Is(context.Cause(ctx), context.Canceled) {
1818
// when this error comes from containerd it is not typed at all, just concatenated string
1919
if strings.Contains(err.Error(), "EOF") {
2020
return true

0 commit comments

Comments
 (0)