isQueryCanceledError checks if the error is due to a query being canceled. This reproduces database.IsQueryCanceledError, but is reimplemented here to avoid importing the database package, which would result in import loops. We also use string matching on the error PostgreSQL returns to us, rather t
(err error)
| 45 | // to us, rather than the pq error type, because we don't want testutil, which is imported in lots |
| 46 | // of places to import lib/pq, which we have our own fork of. |
| 47 | func isQueryCanceledError(err error) bool { |
| 48 | if xerrors.Is(err, context.Canceled) || xerrors.Is(err, context.DeadlineExceeded) { |
| 49 | return true |
| 50 | } |
| 51 | if strings.Contains(err.Error(), "canceling statement due to user request") { |
| 52 | return true |
| 53 | } |
| 54 | return false |
| 55 | } |
| 56 | |
| 57 | type testLogWriter struct { |
| 58 | t testing.TB |
no test coverage detected