mirror of https://github.com/jackc/pgx.git
Simplify SafeToRetry for ErrTimeout
Signed-off-by: Michael Darr <michael.e.darr@gmail.com>query-exec-mode
parent
c0b4d3bc05
commit
b3e64d3cdb
11
errors.go
11
errors.go
|
@ -4,7 +4,6 @@ import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
|
||||||
"net/url"
|
"net/url"
|
||||||
"regexp"
|
"regexp"
|
||||||
"strings"
|
"strings"
|
||||||
|
@ -141,15 +140,7 @@ func (e *ErrTimeout) Error() string {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *ErrTimeout) SafeToRetry() bool {
|
func (e *ErrTimeout) SafeToRetry() bool {
|
||||||
var ctxErr *contextAlreadyDoneError
|
return SafeToRetry(e.err)
|
||||||
if errors.As(e, &ctxErr) {
|
|
||||||
return ctxErr.SafeToRetry()
|
|
||||||
}
|
|
||||||
var netErr net.Error
|
|
||||||
if errors.As(e, &netErr) {
|
|
||||||
return netErr.Temporary()
|
|
||||||
}
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (e *ErrTimeout) Unwrap() error {
|
func (e *ErrTimeout) Unwrap() error {
|
||||||
|
|
Loading…
Reference in New Issue