SafeToRetry checks if the err is guaranteed to have occurred before sending any data to the server.
(err error)
| 12 | |
| 13 | // SafeToRetry checks if the err is guaranteed to have occurred before sending any data to the server. |
| 14 | func SafeToRetry(err error) bool { |
| 15 | var retryableErr interface{ SafeToRetry() bool } |
| 16 | if errors.As(err, &retryableErr) { |
| 17 | return retryableErr.SafeToRetry() |
| 18 | } |
| 19 | return false |
| 20 | } |
| 21 | |
| 22 | // Timeout checks if err was caused by a timeout. To be specific, it is true if err was caused within pgconn by a |
| 23 | // context.DeadlineExceeded or an implementer of net.Error where Timeout() is true. |