diff --git a/retry/retry.go b/retry/retry.go index 0686b0fb..fc1648cf 100644 --- a/retry/retry.go +++ b/retry/retry.go @@ -9,6 +9,7 @@ import ( "github.com/pkg/errors" "io" "net" + "strings" "syscall" "time" ) @@ -197,5 +198,12 @@ func Retryable(err error) bool { return true } + // For errors without a five-digit code, github.com/lib/pq uses fmt.Errorf(). + // This returns an unexported error type prefixed with "pq: " + // Until this gets changed upstream , we can only check the error message. + if strings.HasPrefix(err.Error(), "pq: ") { + return true + } + return false }