Better IndexedDB error handling
This commit is contained in:
parent
53346ff519
commit
2923c26d25
@ -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 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
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 @@
|
|||||||
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user