import dev.caskeleton.adapter.outbound.persistence.api.PersistenceOperationName; import dev.caskeleton.adapter.outbound.persistence.api.error.ConstraintCode; import dev.caskeleton.adapter.outbound.persistence.postgresql.error.PostgreSqlExceptionTranslator; import java.sql.SQLException; import java.time.Duration; public class PostgreSql40003Probe { public static void main(String[] args) { var translator = PostgreSqlExceptionTranslator.with(name -> new ConstraintCode("unknown.constraint")); var ex = translator.translate( new SQLException("completion unknown", "40003"), new PersistenceOperationName("probe.40003"), 1, Duration.ZERO, null); System.out.println("type=" + ex.getClass().getSimpleName()); System.out.println("category=" + ex.category()); System.out.println("sqlState=" + ex.context().sqlState()); System.out.println("completionUnknown=" + ex.completionUnknown()); System.out.println("retryable=" + ex.retryable()); } }