You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I also ran into this error, however, it is not a bug. You simply need to handle errors that can occur during database opening by adding a callback to your new sqlite3.Database constructor and turning it into a promise, like so:
constmode=sqlite3.OPEN_READWRITE|sqlite3.OPEN_FULLMUTEX;// Or whatever you wantconstdb=awaitnewPromise((resolve,reject)=>{constdb_=newsqlite3.Database('xxx/x.db',mode,err=>{if(err){reject(err);}else{resolve(db_);}});});
The provided example is a contrived example to trigger the issue. It's about the error handling in the C++ code and not the JavaScript code, it shouldn't be possible to raise a Node-API C++ exception from Node.js.
Issue Summary
The following crash occurs when a promise doesn't resolve and the SQLite file cannot be opened:
xxx/x.db
but notx.db
Steps to Reproduce
index.js
andindex.test.js
:index.js:
index.test.js:
Version
5.1.2
Node.js Version
18.11.0
How did you install the library?
Via npm on macOS 13.0 Beta (22A5373b) arm64
The text was updated successfully, but these errors were encountered: