mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 11:35:04 +01:00
rename and use StorageError to deal with idb DOMerror
This commit is contained in:
parent
f7f9129b8b
commit
8e590fe53b
@ -39,14 +39,14 @@ export function txnAsPromise(txn) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function iterateCursor(cursor, processValue) {
|
export function iterateCursor(cursorRequest, processValue) {
|
||||||
// TODO: does cursor already have a value here??
|
// TODO: does cursor already have a value here??
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
cursor.onerror = (event) => {
|
cursorRequest.onerror = () => {
|
||||||
reject(new Error("Query failed: " + event.target.errorCode));
|
reject(new StorageError("Query failed", cursorRequest.error));
|
||||||
};
|
};
|
||||||
// collect results
|
// collect results
|
||||||
cursor.onsuccess = (event) => {
|
cursorRequest.onsuccess = (event) => {
|
||||||
const cursor = event.target.result;
|
const cursor = event.target.result;
|
||||||
if (!cursor) {
|
if (!cursor) {
|
||||||
resolve(false);
|
resolve(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user