show error details

This commit is contained in:
2026-04-14 22:56:54 -06:00
parent 88bf6f8428
commit 0c9feefeb5

View File

@@ -6,7 +6,9 @@ export async function fetchAllPages(urlBuilder) {
while (page < totalPages) {
const res = await fetch(urlBuilder(page));
if (!res.ok) {
throw new Error(`HTTP ${res.status} ${res.statusText}`);
const body = await res.text().catch(() => '')
const detail = body ? `: ${body.slice(0, 200)}` : ''
throw new Error(`HTTP ${res.status}${detail}`)
}
const data = await res.json();