From 3ad61eb61ec453597db83c2a2dcf224086856f22 Mon Sep 17 00:00:00 2001
From: Jeffrey Phillips Freeman <the@jeffreyfreeman.me>
Date: Thu, 8 Aug 2024 21:02:54 -0400
Subject: [PATCH] Fixed heatmap rendering so if one of the targets 404 it still
 renders the others

---
 layouts/partials/head.html | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/layouts/partials/head.html b/layouts/partials/head.html
index cf553cf13..ad673f333 100644
--- a/layouts/partials/head.html
+++ b/layouts/partials/head.html
@@ -207,16 +207,20 @@ document.addEventListener("DOMContentLoaded", function() {
     const dataMap = new Map(Object.entries(data));
 
     for ( let i = 1; i < dataSources.length ; i++) {
-      let dataNew = JSON.parse(getJSON(dataSources[i]));
-      let dataMapNew = new Map(Object.entries(dataNew));
+      try {
+        let dataNew = JSON.parse(getJSON(dataSources[i]));
+        let dataMapNew = new Map(Object.entries(dataNew));
 
-      for (let [key, value] of dataMapNew) {
-        let valueOld = dataMap.get(key);
-        if( valueOld ) {
-          dataMap.set(key, valueOld + value);
-        } else {
-          dataMap.set(key, value);
+        for (let [key, value] of dataMapNew) {
+          let valueOld = dataMap.get(key);
+          if( valueOld ) {
+            dataMap.set(key, valueOld + value);
+          } else {
+            dataMap.set(key, value);
+          }
         }
+      } catch(error) {
+        console.error(error, error.stack)
       }
     }
 
-- 
GitLab