diff --git a/src/lib/tw-local-backpack-api.js b/src/lib/tw-local-backpack-api.js index e265cdf6a1c..3e3224870c2 100644 --- a/src/lib/tw-local-backpack-api.js +++ b/src/lib/tw-local-backpack-api.js @@ -68,21 +68,21 @@ const openDB = () => new Promise((resolve, reject) => { const request = indexedDB.open(DATABASE_NAME, DATABASE_VERSION); - request.onupgradeneeded = e => { - const db = e.target.result; + request.onupgradeneeded = event => { + const db = event.target.result; db.createObjectStore(STORE_NAME, { keyPath: 'id', autoIncrement: true }); }; - request.onsuccess = e => { - _db = e.target.result; + request.onsuccess = event => { + _db = event.target.result; resolve(_db); }; - request.onerror = () => { - reject(new Error(`DB error: ${request.error}`)); + request.onerror = event => { + reject(new Error(`DB error: ${event.target.error}`)); }; }); @@ -93,8 +93,8 @@ const getBackpackContents = async ({ const db = await openDB(); return new Promise((resolve, reject) => { const transaction = db.transaction(STORE_NAME, 'readonly'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; const store = transaction.objectStore(STORE_NAME); const items = []; @@ -132,8 +132,8 @@ const saveBackpackObject = async ({ const db = await openDB(); return new Promise((resolve, reject) => { const transaction = db.transaction(STORE_NAME, 'readwrite'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; const store = transaction.objectStore(STORE_NAME); const bodyData = base64ToArrayBuffer(body); @@ -161,8 +161,8 @@ const deleteBackpackObject = async ({ const db = await openDB(); return new Promise((resolve, reject) => { const transaction = db.transaction(STORE_NAME, 'readwrite'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; const store = transaction.objectStore(STORE_NAME); // Convert string IDs to number IDs @@ -181,8 +181,8 @@ const updateBackpackObject = async ({ const db = await openDB(); return new Promise((resolve, reject) => { const transaction = db.transaction(STORE_NAME, 'readwrite'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; const store = transaction.objectStore(STORE_NAME); const getRequest = store.get(id); diff --git a/src/lib/tw-restore-point-api.js b/src/lib/tw-restore-point-api.js index 7bb96795ed0..6b0e1d4040d 100644 --- a/src/lib/tw-restore-point-api.js +++ b/src/lib/tw-restore-point-api.js @@ -160,8 +160,8 @@ const removeExtraneousData = transaction => new Promise(resolve => { */ const removeExtraneousRestorePoints = () => openDB().then(db => new Promise((resolveTransaction, rejectTransaction) => { const transaction = db.transaction(ALL_STORES, 'readwrite'); - transaction.onerror = () => { - rejectTransaction(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + rejectTransaction(new Error(`Transaction error: ${event.target.error}`)); }; // Figuring out which restore points to keep and which to remove is non-trivial. @@ -310,8 +310,8 @@ const createRestorePoint = ( generateThumbnail(vm).then(thumbnailData => { const transaction = db.transaction(ALL_STORES, 'readwrite'); - transaction.onerror = () => { - rejectTransaction(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + rejectTransaction(new Error(`Transaction error: ${event.target.error}`)); }; // Will be generated by database @@ -397,8 +397,8 @@ const createRestorePoint = ( */ const deleteRestorePoint = id => openDB().then(db => new Promise((resolve, reject) => { const transaction = db.transaction(ALL_STORES, 'readwrite'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; const metadataStore = transaction.objectStore(METADATA_STORE); @@ -414,8 +414,8 @@ const deleteRestorePoint = id => openDB().then(db => new Promise((resolve, rejec */ const deleteAllRestorePoints = () => openDB().then(db => new Promise((resolveTransaction, rejectTransaction) => { const transaction = db.transaction(ALL_STORES, 'readwrite'); - transaction.onerror = () => { - rejectTransaction(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + rejectTransaction(new Error(`Transaction error: ${event.target.error}`)); }; const deleteEverything = async () => { @@ -448,8 +448,8 @@ const loadRestorePoint = (vm, id) => openDB().then(db => new Promise((resolvePro const storageHelper = { load: (assetType, assetId, dataFormat) => new Promise((resolveFetch, rejectFetch) => { const transaction = db.transaction([ASSET_STORE], 'readonly'); - transaction.onerror = () => { - rejectFetch(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + rejectFetch(new Error(`Transaction error: ${event.target.error}`)); }; const md5ext = `${assetId}.${dataFormat}`; @@ -474,8 +474,8 @@ const loadRestorePoint = (vm, id) => openDB().then(db => new Promise((resolvePro const loadProjectJSON = () => { const transaction = db.transaction([PROJECT_STORE], 'readonly'); - transaction.onerror = () => { - rejectProject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + rejectProject(new Error(`Transaction error: ${event.target.error}`)); }; const projectStore = transaction.objectStore(PROJECT_STORE); @@ -508,8 +508,8 @@ const loadRestorePoint = (vm, id) => openDB().then(db => new Promise((resolvePro */ const getAllRestorePoints = () => openDB().then(db => new Promise((resolve, reject) => { const transaction = db.transaction([METADATA_STORE], 'readonly'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; /** @type {Metadata[]} */ @@ -552,8 +552,8 @@ const getAllRestorePoints = () => openDB().then(db => new Promise((resolve, reje */ const getThumbnail = id => openDB().then(db => new Promise((resolve, reject) => { const transaction = db.transaction([THUMBNAIL_STORE], 'readonly'); - transaction.onerror = () => { - reject(new Error(`Transaction error: ${transaction.error}`)); + transaction.onerror = event => { + reject(new Error(`Transaction error: ${event.target.error}`)); }; const thumbnailStore = transaction.objectStore(THUMBNAIL_STORE);