Implement error method for gallery progress

Handle instances when Web Crypto API is not available.
pull/4644/head
awsr 2026-02-12 03:16:07 -08:00
parent 63c5e493be
commit 6971f3438c
No known key found for this signature in database
1 changed files with 10 additions and 0 deletions

View File

@ -223,6 +223,15 @@ class SimpleProgressBar {
this.#text.textContent = '';
}
error(message) {
this.#stop();
clearTimeout(this.#hideTimeout);
this.#text.textContent = message;
this.#hideTimeout = setTimeout(() => {
this.clear();
}, 2000);
}
#update(loaded, max) {
if (this.#hideTimeout) {
this.#hideTimeout = null;
@ -655,6 +664,7 @@ async function getHash(str) {
return hex;
} catch (err) {
error('getHash:', err);
galleryProgressBar.error('File hash error');
return undefined;
}
}