From 8e590fe53b4264ba57046282ec2ab785e1c744e8 Mon Sep 17 00:00:00 2001 From: Bruno Windels Date: Sun, 15 Sep 2019 12:23:54 +0200 Subject: [PATCH] rename and use StorageError to deal with idb DOMerror --- src/matrix/storage/idb/utils.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/matrix/storage/idb/utils.js b/src/matrix/storage/idb/utils.js index e51c5dab..299fa894 100644 --- a/src/matrix/storage/idb/utils.js +++ b/src/matrix/storage/idb/utils.js @@ -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?? return new Promise((resolve, reject) => { - cursor.onerror = (event) => { - reject(new Error("Query failed: " + event.target.errorCode)); + cursorRequest.onerror = () => { + reject(new StorageError("Query failed", cursorRequest.error)); }; // collect results - cursor.onsuccess = (event) => { + cursorRequest.onsuccess = (event) => { const cursor = event.target.result; if (!cursor) { resolve(false);