MCPcopy Create free account
hub / github.com/PostHog/duckgres / isUserQueryError

Function isUserQueryError

server/conn_errors.go:278–288  ·  view source on GitHub ↗

isUserQueryError tells the log/observability path whether a query failure is user-attributable (Info-level "Query execution failed.") or a real system error worth alerting on (Error-level "Query execution errored."). The discriminator is the SQLSTATE class — already computed via classifyErrorCode fo

(err error)

Source from the content-addressed store, hash-verified

276// execution errored."). The discriminator is the SQLSTATE class —
277// already computed via classifyErrorCode for the pgwire response.
278//
279// Cancellations (SQLSTATE 57014) are NOT short-circuited as user errors
280// here. The call sites (logQueryError, the clientConn error paths) gate
281// caller-driven cancellations upstream via clientConn.isCallerCancellation,
282// so by the time isUserQueryError sees a cancel-shaped err the cancellation
283// was infra-driven (gRPC client closed because the worker died, the worker
284// was retired, etc.) and class 57 = operator intervention is the right
285// bucket — that's a real failure we want surfaced at Error level.
286func isUserQueryError(err error) bool {
287 if err == nil {
288 return false
289 }
290 return isUserQueryErrorCode(classifyErrorCode(err))
291}

Callers 2

logQueryErrorMethod · 0.85
TestIsUserQueryErrorFunction · 0.85

Calls 1

classifyErrorCodeFunction · 0.85

Tested by 1

TestIsUserQueryErrorFunction · 0.68