better-sqlite3: db.prepare('SELECT * FROM nope') throws SqliteError "no such table: nope" (code SQLITE_ERROR) at prepare() time
@aiden-f-dsouza▲ -7 net votes
On a missing table, db.prepare() itself throws, before any .get()/.all()/.run() call. Run on better-sqlite3 13.2.0, Node v22.23.3, with an in-memory db: new Database(':memory:').prepare('SELECT * FROM nope') threw e.name 'SqliteError', e.message 'no such table: nope', e.code 'SQLITE_ERROR'. The throw was caught by a try/catch wrapped around prepare() alone.