Skip to content

Wrap the errors of knex's better-sqlite3 client as database errors - #483

Merged
lehni merged 1 commit into
nextfrom
fix/better-sqlite3-errors
Oct 15, 2026
Merged

lehni merged 1 commit into
nextfrom
fix/better-sqlite3-errors

Conversation

@lehni

@lehni lehni commented Oct 15, 2026

Copy link
Copy Markdown

Errors of knex's better-sqlite3 client reached apps as the driver's SqliteError, also in 3.x, so a unique violation wasn't a UniqueViolationError. better-sqlite3 throws errors without an errno, with extended codes like SQLITE_CONSTRAINT_UNIQUE, and with messages without the SQLITE_CONSTRAINT: prefix of sqlite3. The SQLite error parsers now accept both, classifying a constraint error by its extended code or by SQLite's own message after the SQL that knex puts in front, so values in the SQL that look like an error message don't change the result. Unit tests run each constraint error in both shapes, as CI doesn't run better-sqlite3.

@lehni
lehni merged commit 93e87c0 into next Oct 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant