aboutsummaryrefslogtreecommitdiff
path: root/ext/wasm/api/sqlite3-api-prologue.js
diff options
context:
space:
mode:
authorstephan <stephan@noemail.net>2022-10-04 17:06:51 +0000
committerstephan <stephan@noemail.net>2022-10-04 17:06:51 +0000
commit9a55773b2f2b5e94afa59ced504e2078af2c565b (patch)
tree126faada6fe7da83fd02d8c55b2ec4df858c695c /ext/wasm/api/sqlite3-api-prologue.js
parented3182f233690989b332f64548d03ef9eb791a5c (diff)
downloadsqlite-9a55773b2f2b5e94afa59ced504e2078af2c565b.tar.gz
sqlite-9a55773b2f2b5e94afa59ced504e2078af2c565b.zip
Replace time-based auto-unlock of opfs sync handles with lock acquisition/release via sqlite3_io_methods::xLock/xUnlock().
FossilOrigin-Name: 2625b7cfe1640c1d7e779ec1f37db970541598c0dc3e22e5eecf3c772d95ad40
Diffstat (limited to 'ext/wasm/api/sqlite3-api-prologue.js')
-rw-r--r--ext/wasm/api/sqlite3-api-prologue.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/ext/wasm/api/sqlite3-api-prologue.js b/ext/wasm/api/sqlite3-api-prologue.js
index 516f53f52..5b80c439b 100644
--- a/ext/wasm/api/sqlite3-api-prologue.js
+++ b/ext/wasm/api/sqlite3-api-prologue.js
@@ -1312,14 +1312,25 @@ self.sqlite3ApiBootstrap = function sqlite3ApiBootstrap(
// Is it okay to resolve these in parallel or do we need them
// to resolve in order? We currently only have 1, so it
// makes no difference.
- lip = lip.map((f)=>f(sqlite3).catch(()=>{}));
+ lip = lip.map((f)=>f(sqlite3).catch((e)=>{
+ console.error("An async sqlite3 initializer failed:",e);
+ }));
//let p = lip.shift();
//while(lip.length) p = p.then(lip.shift());
//return p.then(()=>sqlite3);
return Promise.all(lip).then(()=>sqlite3);
}
};
- sqlite3ApiBootstrap.initializers.forEach((f)=>f(sqlite3));
+ try{
+ sqlite3ApiBootstrap.initializers.forEach((f)=>{
+ f(sqlite3);
+ });
+ }catch(e){
+ /* If we don't report this here, it can get completely swallowed
+ up and disappear into the abyss of Promises and Workers. */
+ console.error("sqlite3 bootstrap initializer threw:",e);
+ throw e;
+ }
delete sqlite3ApiBootstrap.initializers;
sqlite3ApiBootstrap.sqlite3 = sqlite3;
return sqlite3;