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

Function binderErrorCode

server/conn_errors.go:192–207  ·  view source on GitHub ↗

binderErrorCode narrows a "Binder Error: …" message. The binder raises on semantic problems discovered after parsing, most commonly missing columns.

(msg string)

Source from the content-addressed store, hash-verified

190// and the control plane further prefixes worker failures with "flight execute
191// update: " (and similar). When the message is not Flight-wrapped it is returned
192// unchanged, so this is safe to apply unconditionally before prefix matching.
193func unwrapFlightError(msg string) string {
194 // gRPC puts the real message after the final "desc = ".
195 if idx := strings.LastIndex(msg, "desc = "); idx != -1 {
196 msg = msg[idx+len("desc = "):]
197 }
198 msg = strings.TrimSpace(msg)
199 // The worker's Flight SQL handler wraps the raw DuckDB error one more time
200 // with "failed to execute query: " / "failed to execute update: " (see
201 // duckdbservice/flight_handler.go). That sits between "desc = " and the
202 // DuckDB exception prefix, so without stripping it the HasPrefix("Catalog
203 // Error:" …) classifiers below all miss and the error falls through to
204 // XX000. Strip any one such worker prefix so classification sees the bare
205 // DuckDB message.
206 for _, p := range []string{"failed to execute update: ", "failed to execute query: "} {
207 if strings.HasPrefix(msg, p) {
208 msg = strings.TrimSpace(msg[len(p):])
209 break
210 }

Callers 1

classifyErrorCodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected