Skip to main content

eval_error_code

Function eval_error_code 

Source
fn eval_error_code(err: &EvalError) -> SqlState
Expand description

Maps an EvalError to the appropriate SQLSTATE.

Historically every EvalError fell through to INTERNAL_ERROR (XX000), but the overwhelming majority are user-facing data exceptions (class 22) or other well-defined conditions, not internal errors. This match is deliberately exhaustive — with no wildcard — so that adding a new EvalError variant is a compile error until it is assigned a code, and we never silently regress to XX000. Codes are chosen to match PostgreSQL where an equivalent error exists.