Debug: näytä palvelimen raakavastaus virhealertissa

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-11 14:03:06 +02:00
parent e3ef6d84b7
commit ea2fdcb316

View File

@@ -36,7 +36,7 @@ async function apiCall(action, method = 'GET', body = null) {
let data;
try { data = JSON.parse(text); } catch (e) {
console.error('API JSON parse error:', action, text.slice(0, 500));
throw new Error('Palvelin palautti virheellisen vastauksen');
throw new Error('API virhe (' + action + '): ' + text.slice(0, 300));
}
if (!res.ok) throw new Error(data.error || 'Virhe');
return data;