Skip to main content

Module error

Module error 

Source
Expand description

sqlx::ErrorEngineError mapping for the Postgres backend.

RFC-v0.7 Wave 0. This is a map-sketch: enough surface for subsequent waves’ trait-method bodies to route transport faults through EngineError::Transport { backend: "postgres", .. } plus the two typed cases the design-question matrix already pinned:

  • SqlState::UniqueViolation (23505) → EngineError::Conflict — mirrors the Valkey backend’s conflict classification for duplicate-key writes (e.g. waitpoint id collision, unique index violation on ff_completion_event etc.).
  • SqlState::SerializationFailure (40001) / DeadlockDetected (40P01) → EngineError::Contention — per Q11 (isolation level default) these are the retryable serialization faults SERIALIZABLE can raise; callers retry per RFC-010 §10.7.

Every other sqlx::Error boxes through Transport as a safe default. Future waves refine (e.g. RowNotFoundNotFound, connection-pool-closed → Unavailable).

Structs§

PostgresTransportError
Thin newtype over sqlx::Error so a blanket From<sqlx::Error> for EngineError doesn’t conflict with ff-core’s own orphan rules when downstream crates add their own. Backend-internal call sites use map_sqlx_error directly; this wrapper exists for future cases where we want to attach a typed source to a different EngineError variant.

Functions§

map_sqlx_error
Convert a sqlx::Error into an EngineError.