From a85c2dc46d441424eb7ecaa727ddaa91385ba976 Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Mon, 18 May 2020 15:54:29 -0400 Subject: [PATCH] API: handle pq cancellation errors gracefully --- api/server.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/api/server.go b/api/server.go index f393121..da36707 100644 --- a/api/server.go +++ b/api/server.go @@ -122,10 +122,15 @@ func main() { if errors.Is(origErr, context.Canceled) { return origErr } + if errors.Is(origErr, context.DeadlineExceeded) { return origErr } + if origErr.Error() == "pq: canceling statement due to user request" { + return origErr + } + stack := make([]byte, 32768) // 32 KiB i := runtime.Stack(stack, false) log.Println(string(stack[:i])) -- 2.38.4