Skip to content

Commit d8f525d

Browse files
error handling for refresh
1 parent 8c3e400 commit d8f525d

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/js/index.js

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -399,22 +399,25 @@ function getChildren(folderId) {
399399
});
400400
}
401401

402-
async function refreshAllThumbnails() {
403-
//const allFolders = folders.concat(speedDialId);
402+
function refreshAllThumbnails() {
404403
let urls = [];
405-
406-
let children = await browser.bookmarks.getChildren(currentFolder);
407-
for (let child of children) {
408-
if (child.url && (child.url.startsWith('https://') || child.url.startsWith('http://'))) {
409-
urls.push(child.url);
410-
}
411-
}
412-
404+
413405
hideModals();
414406

415-
tabMessagePort.postMessage({refreshAll: true, urls});
416-
toastContent.innerText = ` Capturing images...`;
417-
toast.style.transform = "translateX(0%)";
407+
browser.bookmarks.getChildren(currentFolder).then(children => {
408+
if (children && children.length) {
409+
for (let child of children) {
410+
if (child.url && (child.url.startsWith('https://') || child.url.startsWith('http://'))) {
411+
urls.push(child.url);
412+
}
413+
}
414+
tabMessagePort.postMessage({refreshAll: true, urls});
415+
toastContent.innerText = ` Capturing images...`;
416+
toast.style.transform = "translateX(0%)";
417+
}
418+
}).catch(err => {
419+
console.log(err);
420+
});
418421
}
419422

420423
// assumes 'bookmarks' param is content of a folder (from getBookmarks)

0 commit comments

Comments
 (0)