Skip to main content

map_pg_error

Function map_pg_error 

Source
pub fn map_pg_error(err: &Error, context: &str) -> TargetError
Expand description

Maps a tokio_postgres::Error to the proper TargetError variant.

Connection-class errors (SQLSTATE 08, closed connection, IO) become NotConnected so the queue store retains the payload for replay. Schema and constraint problems (SQLSTATE 23, 42) become Configuration so they are surfaced to the operator without endless retry. Transaction-rollback errors (SQLSTATE class 40, e.g. serialization failure or deadlock) become Timeout so they are retried transiently.