Minor Changes
-
#806
73b5dabThanks @gajus! - Expose the violatedcolumns(and rawdetail) onIntegrityConstraintViolationErrorIntegrityConstraintViolationErrorand its subclasses (UniqueIntegrityConstraintViolationError,ForeignKeyIntegrityConstraintViolationError,NotNullIntegrityConstraintViolationError,CheckIntegrityConstraintViolationError) now expose two additional fields:columns: readonly string[]— the column(s) involved in the violation. Postgres only populates the wire-protocolcolumnfield for not-NULL violations; for unique and foreign key violations the column(s) are parsed from the errordetail(e.g.Key (email)=(...) already exists.). This lets application code branch on the offending column(s) instead of coupling to a raw constraint/index name. Expression and partial index columns are intentionally not extracted (the array is left empty rather than reporting a misleading name).detail: null | string— the raw Postgres error detail string, exposed directly on the error.
The existing singular
columnfield is unchanged.
Patch Changes
- Updated dependencies []:
- @slonik/types@49.8.0