From fe5dd3e58a8f110c11b3366512150cacc14c2ea1 Mon Sep 17 00:00:00 2001 From: marwin Date: Fri, 20 Mar 2026 06:43:36 +0100 Subject: [PATCH] Debug: show specific error in book list instead of generic message Co-Authored-By: Claude Sonnet 4.6 --- static/js/app.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/static/js/app.js b/static/js/app.js index 5d37711..43464dd 100644 --- a/static/js/app.js +++ b/static/js/app.js @@ -2148,7 +2148,15 @@ async function loadBookList() { try { const res = await fetch('/books/'); + if (!res.ok) { + listEl.innerHTML = `

Server error ${res.status} loading books.

`; + return; + } const books = await res.json(); + if (!Array.isArray(books)) { + listEl.innerHTML = `

Unexpected response from server.

`; + return; + } if (!books.length) { listEl.innerHTML = '

No books yet. Drop an .epub or .pdf above.

'; return; @@ -2169,7 +2177,7 @@ async function loadBookList() { } renderBookList(decrypted); } catch (e) { - if (listEl) listEl.innerHTML = '

Failed to load books.

'; + if (listEl) listEl.innerHTML = `

Error: ${e.message}

`; } }