« get me outta code hell

content, client: handle random data failing to load - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/static/client3.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-11-15 18:56:10 -0400
committer(quasar) nebula <qznebula@protonmail.com>2023-11-15 18:56:58 -0400
commit28371f6e029fb86ba536bf4c20e787dba44d202b (patch)
tree8fef79f97b06d136ccbe920f9729d5dedc984e51 /src/static/client3.js
parent91f00a36b33d13630ea7a9ac6fcd03110b0f1a73 (diff)
content, client: handle random data failing to load
Diffstat (limited to 'src/static/client3.js')
-rw-r--r--src/static/client3.js15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/static/client3.js b/src/static/client3.js
index 31eddfe9..d2f2bd17 100644
--- a/src/static/client3.js
+++ b/src/static/client3.js
@@ -287,6 +287,7 @@ if (
 ) {
   const dataLoadingLine = document.getElementById('data-loading-line');
   const dataLoadedLine = document.getElementById('data-loaded-line');
+  const dataErrorLine = document.getElementById('data-error-line');
 
   dataLoadingLine.style.display = 'block';
 
@@ -300,8 +301,20 @@ if (
 
       dataLoadingLine.style.display = 'none';
       dataLoadedLine.style.display = 'block';
-    });
+    })
+    .catch(() => {
+      const info = scriptedLinkInfo;
+
+      for (const a of info.randomLinks) {
+        const href = determineRandomLinkHref(a);
+        if (!href) {
+          a.removeAttribute('href');
+        }
+      }
 
+      dataLoadingLine.style.display = 'none';
+      dataErrorLine.style.display = 'block';
+    });
 }
 
 // Data & info card ---------------------------------------