2
0

Simplify SafeToRetry for ErrTimeout

Signed-off-by: Michael Darr <michael.e.darr@gmail.com>
This commit is contained in:
Michael Darr
2021-07-06 15:36:46 -04:00
committed by Jack Christensen
parent c0b4d3bc05
commit b3e64d3cdb
+1 -10
View File
@@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"net"
"net/url"
"regexp"
"strings"
@@ -141,15 +140,7 @@ func (e *ErrTimeout) Error() string {
}
func (e *ErrTimeout) SafeToRetry() bool {
var ctxErr *contextAlreadyDoneError
if errors.As(e, &ctxErr) {
return ctxErr.SafeToRetry()
}
var netErr net.Error
if errors.As(e, &netErr) {
return netErr.Temporary()
}
return false
return SafeToRetry(e.err)
}
func (e *ErrTimeout) Unwrap() error {