show error details
This commit is contained in:
@@ -6,7 +6,9 @@ export async function fetchAllPages(urlBuilder) {
|
|||||||
while (page < totalPages) {
|
while (page < totalPages) {
|
||||||
const res = await fetch(urlBuilder(page));
|
const res = await fetch(urlBuilder(page));
|
||||||
if (!res.ok) {
|
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();
|
const data = await res.json();
|
||||||
|
|||||||
Reference in New Issue
Block a user