Skip to content

Commit 104e026

Browse files
committed
uses context Canceled error
1 parent 0db266c commit 104e026

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

boxutil/status.go

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,9 @@ package boxutil
22

33
import (
44
"context"
5-
"errors"
65
"time"
76
)
87

9-
// ErrCanceled is returned when the context cancels or times out
10-
// an operation.
11-
var ErrCanceled = errors.New("context is done")
12-
138
// readyCheckInterval is the interval to wait between checking
149
// the status in StatusChan.
1510
// Unexported because 1 second is sensible, but configurable to make
@@ -51,7 +46,7 @@ func WaitForReady(ctx context.Context, i Box) error {
5146
for {
5247
select {
5348
case <-ctx.Done():
54-
return ErrCanceled
49+
return ctx.Err()
5550
case status := <-statusChan:
5651
if IsReady(status) {
5752
return nil

boxutil/status_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func TestWaitForReadyTimeout(t *testing.T) {
5555
i.setReady()
5656
}()
5757
err := WaitForReady(ctx, i)
58-
is.Equal(err, ErrCanceled)
58+
is.Equal(err, context.Canceled)
5959
}
6060

6161
type testBox struct {

0 commit comments

Comments
 (0)