libsql-js icon indicating copy to clipboard operation
libsql-js copied to clipboard

SQLiteError triggers TypeError in Bun

Open depsimon opened this issue 7 months ago • 0 comments

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.

depsimon avatar May 09 '25 12:05 depsimon