Debug: show specific error in book list instead of generic message
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
824b77a033
commit
fe5dd3e58a
1 changed files with 9 additions and 1 deletions
|
|
@ -2148,7 +2148,15 @@ async function loadBookList() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const res = await fetch('/books/');
|
const res = await fetch('/books/');
|
||||||
|
if (!res.ok) {
|
||||||
|
listEl.innerHTML = `<p class="muted">Server error ${res.status} loading books.</p>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
const books = await res.json();
|
const books = await res.json();
|
||||||
|
if (!Array.isArray(books)) {
|
||||||
|
listEl.innerHTML = `<p class="muted">Unexpected response from server.</p>`;
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (!books.length) {
|
if (!books.length) {
|
||||||
listEl.innerHTML = '<p class="muted">No books yet. Drop an .epub or .pdf above.</p>';
|
listEl.innerHTML = '<p class="muted">No books yet. Drop an .epub or .pdf above.</p>';
|
||||||
return;
|
return;
|
||||||
|
|
@ -2169,7 +2177,7 @@ async function loadBookList() {
|
||||||
}
|
}
|
||||||
renderBookList(decrypted);
|
renderBookList(decrypted);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
if (listEl) listEl.innerHTML = '<p class="muted">Failed to load books.</p>';
|
if (listEl) listEl.innerHTML = `<p class="muted">Error: ${e.message}</p>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue