diff --git a/pug/includes/tag-status.pug b/pug/includes/tag-status.pug index 5ecd97d..25e2362 100644 --- a/pug/includes/tag-status.pug +++ b/pug/includes/tag-status.pug @@ -29,7 +29,7 @@ if downloader.total > 0 || downloader.outcome .s-progress--bar(style=`width: ${percentage}`) .d-flex.jc-space-between.fs-fine span= percentage - span= downloader.total + span processed #{downloader.processed} of #{downloader.total} else if downloader.outcome === "Success" .s-notice.s-notice__success.p8.gx16.pl16.d-flex.ai-center @@ -40,7 +40,9 @@ if downloader.total > 0 || downloader.outcome a.s-btn.s-btn__outlined(href=and({arrange: "tag", shape: "grid"})) Refresh else - .s-notice.s-notice__danger.p8.gx16.pl16.d-flex.ai-center + form.s-notice.s-notice__danger.d-flex.ai-center.p8.gx16.pl16(role="status" hx-target="#tag-download" hx-select="#tag-download" hx-post="/api/tag-download") title#title(hx-swap-oob="true") * Tag download failed! | BC Explorer != icons.get("cloud-xmark") .fl-grow1= downloader.outcome + input(type="hidden" name="account" value=account) + button.s-btn.s-btn__outlined Try again diff --git a/routes/load-collection.js b/routes/load-collection.js index 8d17e57..5943cc3 100644 --- a/routes/load-collection.js +++ b/routes/load-collection.js @@ -66,13 +66,10 @@ async function loadCollection(inputUsername) { }) } catch (cause) { throw new class extends Error { - constructor() { - super("Unsupported album/track data", {cause}) - this.name = "Collection Import Error" - this.account = account - this.item = item - } - } + name = "Item Import Error" + item = item + cause = cause + }("Unsupported album/track data") } } })() @@ -112,7 +109,12 @@ router.post("/api/load-collection", defineEventHandler(async event => { const result = await loadCollection(account) setCookie(event, "accounts", (getCookie(event, "accounts") || "").split("|").concat(account).join("|")) return pugSync.render(event, "collection-loaded.pug", result) - } catch (error) { + } catch (cause) { + const error = new class extends Error { + name = "Collection Import Error" + account = account + cause = cause + }("Details logged to console. Please ask Cadence to fix it!") console.error(error) return pugSync.render(event, "collection-loaded.pug", {error}) } diff --git a/routes/load-tags.js b/routes/load-tags.js index 99783c7..4060d99 100644 --- a/routes/load-tags.js +++ b/routes/load-tags.js @@ -88,7 +88,7 @@ class TagDownloader extends sync.reloadClassMethods(() => TagDownloader) { } this.outcome = "Success" } catch (e) { - console.error(`error downloading tags for ${this.account} - ${e}`) + console.error(`error downloading tags for ${this.account} -`, e) this.outcome = e.toString() } finally { this.running = false