Always double-wrap contextAlreadyDoneError
Signed-off-by: Michael Darr <michael.e.darr@gmail.com>
This commit is contained in:
committed by
Jack Christensen
parent
b3e64d3cdb
commit
9a9830c00d
@@ -163,15 +163,9 @@ func (e *contextAlreadyDoneError) Unwrap() error {
|
|||||||
return e.err
|
return e.err
|
||||||
}
|
}
|
||||||
|
|
||||||
// newContextAlreadyDoneError wraps a context error in `contextAlreadyDoneError`. If the context was cancelled or its
|
// newContextAlreadyDoneError double-wraps a context error in `contextAlreadyDoneError` and `ErrTimeout`.
|
||||||
// deadline passed, the returned error is also wrapped by `ErrTimeout`.
|
|
||||||
func newContextAlreadyDoneError(ctx context.Context) (err error) {
|
func newContextAlreadyDoneError(ctx context.Context) (err error) {
|
||||||
ctxErr := ctx.Err()
|
return &ErrTimeout{&contextAlreadyDoneError{err: ctx.Err()}}
|
||||||
err = &contextAlreadyDoneError{err: ctxErr}
|
|
||||||
if ctxErr != nil {
|
|
||||||
err = &ErrTimeout{err: err}
|
|
||||||
}
|
|
||||||
return err
|
|
||||||
}
|
}
|
||||||
|
|
||||||
type writeError struct {
|
type writeError struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user