github gajus/slonik @slonik/errors@49.8.0

latest releases: @slonik/test-ssls@49.8.0, @slonik/utilities@49.8.0, @slonik/sql-tag@49.8.0...
3 hours ago

Minor Changes

  • #806 73b5dab Thanks @gajus! - Expose the violated columns (and raw detail) on IntegrityConstraintViolationError

    IntegrityConstraintViolationError and 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-protocol column field for not-NULL violations; for unique and foreign key violations the column(s) are parsed from the error detail (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 column field is unchanged.

Patch Changes

  • Updated dependencies []:
    • @slonik/types@49.8.0

Don't miss a new slonik release

NewReleases is sending notifications on new releases.