~edwargix/git.sr.ht

a85c2dc46d441424eb7ecaa727ddaa91385ba976 — Drew DeVault 5 years ago a2efeec
API: handle pq cancellation errors gracefully
1 files changed, 5 insertions(+), 0 deletions(-)

M api/server.go
M api/server.go => api/server.go +5 -0
@@ 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]))