Skip to main content

map_sqlx_error

Function map_sqlx_error 

Source
pub fn map_sqlx_error(err: Error) -> AwaError
Expand description

The single Rust-side mapping from a raw sqlx::Error to an AwaError, translating a Postgres unique violation (SQLSTATE 23505) into AwaError::UniqueConflict with the offending constraint name.

Insert paths call this explicitly rather than relying on the blanket From<sqlx::Error> (which preserves the raw error for general ? use). Database adapters running Awa’s insert SQL through another driver should route the underlying sqlx error through here so their errors match the native path.