Skip to content

fix(db): distinguish database open failures - #17

Merged
SSBrouhard merged 2 commits into
SSBrouhard:mainfrom
Tomauskasz:fix/report-sqlite-runtime-errors
Aug 3, 2026
Merged

fix(db): distinguish database open failures#17
SSBrouhard merged 2 commits into
SSBrouhard:mainfrom
Tomauskasz:fix/report-sqlite-runtime-errors

Conversation

@Tomauskasz

Copy link
Copy Markdown
Contributor

Summary

  • Report native addon load failures as SQLITE_RUNTIME_ERROR and retain the original cause.
  • Report locked, unreadable, and other availability failures as DB_OPEN_ERROR.
  • Reserve INVALID_DB for SQLite format and corruption errors.
  • Document the revised error contract.

The previous catch block converted every better-sqlite3 open failure into INVALID_DB. This hid native ABI failures such as a Node runtime requiring NODE_MODULE_VERSION 147 while the installed addon was built for 137, and incorrectly blamed the selected database.

Verification

  • npm run build
  • npm test — 12 test files, 50 tests passed
  • npm exec -- tsc --noEmit -p tsconfig.json
  • git diff --check

@Tomauskasz
Tomauskasz requested a review from SSBrouhard as a code owner July 28, 2026 05:13
@SSBrouhard
SSBrouhard merged commit df65ae9 into SSBrouhard:main Aug 3, 2026
1 of 2 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.

2 participants