From ffd1c24b6cf9eedcceb63c5a8b5f0ef7c7a9c0e8 Mon Sep 17 00:00:00 2001 From: Joel Brock Date: Thu, 28 May 2026 07:56:53 -0700 Subject: [PATCH] loader: warn when links.json parses fail instead of silently using example --- assets/js/app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/assets/js/app.js b/assets/js/app.js index cc76f19..eab7f5b 100644 --- a/assets/js/app.js +++ b/assets/js/app.js @@ -712,7 +712,15 @@ try { const res = await fetch(src, { cache: "no-cache" }); if (!res.ok) { lastErr = new Error(`${src}: HTTP ${res.status}`); continue; } - return await res.json(); + try { + return await res.json(); + } catch (parseErr) { + // File loaded but JSON is malformed — surface this loudly instead of + // silently falling back to the next source. + console.warn(`[dlstack] ${src} loaded but failed to parse — falling back. Fix the JSON to see your content.`, parseErr); + lastErr = new Error(`${src}: invalid JSON — ${parseErr.message}`); + continue; + } } catch (err) { lastErr = err; } } throw lastErr || new Error("No data file found.");