This commit is contained in:
Lizandro Guarnizo
2026-01-22 11:29:24 -05:00
parent 84e2d1d236
commit fcba5919a8
5 changed files with 31 additions and 7 deletions
+4 -1
View File
@@ -530,8 +530,11 @@ if (empty($user_id)) {
}
return JSON.parse(text);
} catch (err) {
// Incluir parte del cuerpo en el error para ayudar al diagnóstico (truncado)
console.error('apiCall parse error for', url, err);
throw new Error('Invalid JSON response from ' + url + ': ' + err.message);
const respText = await response.text().catch(() => '');
const snippet = (respText && respText.length > 0) ? respText.substr(0, 1000) : '<no body available>';
throw new Error('Invalid JSON response from ' + url + ': ' + err.message + ' -- response snippet: ' + snippet);
}
}
}