« get me outta code hell

upd8: report precache errors more nicely - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-06-02 22:27:50 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-06-02 22:28:37 -0300
commit10174e6b269c8479ebeb12b3e76a694327aafd73 (patch)
tree9a41302ec5dec4b57e6254005b0eb67116b7aae8 /src
parent95e159660f60491786233fe33d78f049c12d9d01 (diff)
upd8: report precache errors more nicely
Diffstat (limited to 'src')
-rwxr-xr-xsrc/upd8.js29
1 files changed, 23 insertions, 6 deletions
diff --git a/src/upd8.js b/src/upd8.js
index 82ba8a6c..9e4ef4fb 100755
--- a/src/upd8.js
+++ b/src/upd8.js
@@ -1543,14 +1543,31 @@ async function main() {
       ]),
     };
 
-    for (const [wikiDataKey, properties] of Object.entries(commonDataMap)) {
-      const thingData = wikiData[wikiDataKey];
-      const allProperties = new Set(['name', 'directory', ...properties]);
-      for (const thing of thingData) {
-        for (const property of allProperties) {
-          void thing[property];
+    try {
+      for (const [wikiDataKey, properties] of Object.entries(commonDataMap)) {
+        const thingData = wikiData[wikiDataKey];
+        const allProperties = new Set(['name', 'directory', ...properties]);
+        for (const thing of thingData) {
+          for (const property of allProperties) {
+            void thing[property];
+          }
         }
       }
+    } catch (error) {
+      if (!paragraph) console.log('');
+      niceShowAggregate(error);
+      console.log('');
+
+      logError`There was an error precaching internal data objects.`;
+      fileIssue();
+
+      Object.assign(stepStatusSummary.precacheCommonData, {
+        status: STATUS_FATAL_ERROR,
+        annotation: `see log for details`,
+        timeEnd: Date.now(),
+      });
+
+      return false;
     }
 
     Object.assign(stepStatusSummary.precacheCommonData, {