Allow retrying failed tag sync
This commit is contained in:
parent
3b22fe98f2
commit
199a44a8a7
3 changed files with 15 additions and 11 deletions
|
@ -29,7 +29,7 @@ if downloader.total > 0 || downloader.outcome
|
||||||
.s-progress--bar(style=`width: ${percentage}`)
|
.s-progress--bar(style=`width: ${percentage}`)
|
||||||
.d-flex.jc-space-between.fs-fine
|
.d-flex.jc-space-between.fs-fine
|
||||||
span= percentage
|
span= percentage
|
||||||
span= downloader.total
|
span processed #{downloader.processed} of #{downloader.total}
|
||||||
|
|
||||||
else if downloader.outcome === "Success"
|
else if downloader.outcome === "Success"
|
||||||
.s-notice.s-notice__success.p8.gx16.pl16.d-flex.ai-center
|
.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
|
a.s-btn.s-btn__outlined(href=and({arrange: "tag", shape: "grid"})) Refresh
|
||||||
|
|
||||||
else
|
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
|
title#title(hx-swap-oob="true") * Tag download failed! | BC Explorer
|
||||||
!= icons.get("cloud-xmark")
|
!= icons.get("cloud-xmark")
|
||||||
.fl-grow1= downloader.outcome
|
.fl-grow1= downloader.outcome
|
||||||
|
input(type="hidden" name="account" value=account)
|
||||||
|
button.s-btn.s-btn__outlined Try again
|
||||||
|
|
|
@ -66,13 +66,10 @@ async function loadCollection(inputUsername) {
|
||||||
})
|
})
|
||||||
} catch (cause) {
|
} catch (cause) {
|
||||||
throw new class extends Error {
|
throw new class extends Error {
|
||||||
constructor() {
|
name = "Item Import Error"
|
||||||
super("Unsupported album/track data", {cause})
|
item = item
|
||||||
this.name = "Collection Import Error"
|
cause = cause
|
||||||
this.account = account
|
}("Unsupported album/track data")
|
||||||
this.item = item
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})()
|
})()
|
||||||
|
@ -112,7 +109,12 @@ router.post("/api/load-collection", defineEventHandler(async event => {
|
||||||
const result = await loadCollection(account)
|
const result = await loadCollection(account)
|
||||||
setCookie(event, "accounts", (getCookie(event, "accounts") || "").split("|").concat(account).join("|"))
|
setCookie(event, "accounts", (getCookie(event, "accounts") || "").split("|").concat(account).join("|"))
|
||||||
return pugSync.render(event, "collection-loaded.pug", result)
|
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)
|
console.error(error)
|
||||||
return pugSync.render(event, "collection-loaded.pug", {error})
|
return pugSync.render(event, "collection-loaded.pug", {error})
|
||||||
}
|
}
|
||||||
|
|
|
@ -88,7 +88,7 @@ class TagDownloader extends sync.reloadClassMethods(() => TagDownloader) {
|
||||||
}
|
}
|
||||||
this.outcome = "Success"
|
this.outcome = "Success"
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(`error downloading tags for ${this.account} - ${e}`)
|
console.error(`error downloading tags for ${this.account} -`, e)
|
||||||
this.outcome = e.toString()
|
this.outcome = e.toString()
|
||||||
} finally {
|
} finally {
|
||||||
this.running = false
|
this.running = false
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue