Commit a219b0bc authored by JC Brand's avatar JC Brand

Better IndexedDB error handling

parent be632b36
...@@ -231,13 +231,15 @@ ...@@ -231,13 +231,15 @@
try { try {
store= db.transaction([bare_jid], "readwrite").objectStore(bare_jid); store= db.transaction([bare_jid], "readwrite").objectStore(bare_jid);
} catch (e) { } catch (e) {
console.error(e);
return promise.resolve(); return promise.resolve();
} }
const request = store.clear(); const request = store.clear();
request.onsuccess = promise.resolve(); request.onsuccess = promise.resolve();
request.onerror = promise.resolve(); request.onerror = promise.resolve();
}; };
db_request.onerror = function (ev) {
return promise.reject(ev.target.error);
}
return promise; return promise;
} }
...@@ -313,9 +315,10 @@ ...@@ -313,9 +315,10 @@
} }
return async done => { return async done => {
const _converse = await initConverse(settings); let _converse;
async function _done () { async function _done () {
if (_converse.api.connection.connected()) { if (_converse && _converse.api.connection.connected()) {
await _converse.api.user.logout(); await _converse.api.user.logout();
} }
const el = document.querySelector('#conversejs'); const el = document.querySelector('#conversejs');
...@@ -325,8 +328,9 @@ ...@@ -325,8 +328,9 @@
document.title = "Converse Tests"; document.title = "Converse Tests";
done(); done();
} }
await Promise.all((promise_names || []).map(_converse.api.waitUntil));
try { try {
_converse = await initConverse(settings);
await Promise.all((promise_names || []).map(_converse.api.waitUntil));
await func(_done, _converse); await func(_done, _converse);
} catch(e) { } catch(e) {
console.error(e); console.error(e);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment