This commit is contained in:
2026-02-15 22:19:48 -06:00
parent 749f734aff
commit 782b1d2931
9 changed files with 1400 additions and 269 deletions

View File

@@ -31,8 +31,15 @@ async function request<T>(
});
if (!response.ok) {
const error = await response.json().catch(() => ({ error: 'Request failed' }));
throw new Error(error.error || 'Request failed');
const body = await response.text();
let errorMsg = 'Request failed';
try {
const error = JSON.parse(body);
errorMsg = error.error || error.message || body;
} catch {
errorMsg = body || errorMsg;
}
throw new Error(errorMsg);
}
return response.json();