tursodatabase / tursodatabase/libsql-js
SQLiteError triggers TypeError in Bun
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 335
- Forks
- 48
- Avg merge
- 3d 2h
- Merged PRs (30d)
- 3
Description
When using Bun as the runtime and a local DB file, whenever a SqliteError is thrown, a TypeError is actually thrown.
TypeError: First argument must be an Error object
at new SqliteError (/Users/simon/Code/Github/project/node_modules/libsql/sqlite-error.js:22:8)
at convertError (/Users/simon/Code/Github/project/node_modules/libsql/index.js:60:10)
at run (/Users/simon/Code/Github/project/node_modules/libsql/index.js:353:10)
I dug a little and found a few things:
- When using a Turso DB, it's fine
- When using Node + local DB, it's fine
- It's triggered at this line: https://github.com/tursodatabase/libsql-js/blob/main/sqlite-error.js#L14
Not sure why it works with a Turso DB. I suspect that Node & Bun validates Error differently.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the error with Bun and a local database, then start at sqlite-error.js line 14 and trace the call through convertError and run in libsql/index.js. Compare the local SQLite and Turso paths, with the goal that a thrown SQLite error remains a SqliteError rather than becoming a TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- bun, javascript, sqlite
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100