Whether error is a unique or primary-key violation, from any adapter:
PostgreSQL's SQLSTATE 23505 (unique_violation, pg's code),
better-sqlite3's SQLITE_CONSTRAINT_UNIQUE and
SQLITE_CONSTRAINT_PRIMARYKEY, and the "UNIQUE constraint failed" message
that sql.js, the IndexedDB adapter and the Capacitor plugin give. An error
that wraps one as its cause, to any depth up to ten, counts too.
Whether
erroris a unique or primary-key violation, from any adapter: PostgreSQL's SQLSTATE23505(unique_violation, pg'scode), better-sqlite3'sSQLITE_CONSTRAINT_UNIQUEandSQLITE_CONSTRAINT_PRIMARYKEY, and the "UNIQUE constraint failed" message that sql.js, the IndexedDB adapter and the Capacitor plugin give. An error that wraps one as itscause, to any depth up to ten, counts too.Example