From 6f7cddd1e520da3dc578999574b5465bfad1d4d7 Mon Sep 17 00:00:00 2001 From: nmemmert <67961292+nmemmert@users.noreply.github.com> Date: Wed, 14 Oct 2026 15:50:24 -0400 Subject: [PATCH] Show the server's error message when the library fails to load Co-Authored-By: Claude Sonnet 5.5 --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 3880950..63f5a52 100644 --- a/index.html +++ b/index.html @@ -169,7 +169,7 @@ const series = b => pick(b, 'series_name', 'series') || ''; const cover = b => `/api/books/${encodeURIComponent(bookId(b))}/cover`; const fmt = s => { s = Math.max(0, Math.floor(s || 0)); const h = Math.floor(s/3600), m = Math.floor(s%3600/60), x = s%60; return (h ? h + ':' + String(m).padStart(2, '0') : m) + ':' + String(x).padStart(2, '0'); }; -const get = async p => { const r = await fetch(p); if (r.status === 401) { location.href = '/login'; throw new Error('Signing in…'); } if (!r.ok) throw new Error(r.status === 401 ? 'Not signed in (401)' : p + ' → ' + r.status); return r.json(); }; +const get = async p => { const r = await fetch(p); if (r.status === 401) { location.href = '/login'; throw new Error('Signing in…'); } if (!r.ok) { let m = ''; try { m = (await r.json()).error || ''; } catch {} throw new Error(m || p + ' → ' + r.status); } return r.json(); }; const store = { get: k => { try { return JSON.parse(localStorage.getItem(k)); } catch { return null; } }, set: (k, v) => { try { localStorage.setItem(k, JSON.stringify(v)); } catch {} }